This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
class App extends Component { | |
render() { | |
return ( | |
<div className="App"> | |
<header className="App-header"> | |
<img src={logo} className="App-logo" alt="logo" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Developer { | |
constructor(firstname, lastname) { | |
this.firstname = firstname; | |
this.lastname = lastname; | |
} | |
getName() { | |
return this.firstname + ' ' + this.lastname; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Developer { | |
constructor(firstname, lastname) { | |
this.firstname = firstname; | |
this.lastname = lastname; | |
} | |
getName() { | |
return this.firstname + ' ' + this.lastname; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
class App extends Component { | |
render() { | |
return ( | |
<div> | |
<h1>Welcome to React</h1> | |
</div> | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
class App extends Component { | |
getGreeting() { | |
return 'Welcome to React'; | |
} | |
render() { | |
return ( | |
<div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JavaScript ES5 function | |
function getGreeting() { | |
return 'Welcome to JavaScript'; | |
} | |
// JavaScript ES6 arrow function with body | |
const getGreeting = () => { | |
return 'Welcome to JavaScript'; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (props) { | |
return view; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Greeting(props) { | |
return <h1>{props.greeting}</h1>; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JavaScript ES5 function | |
function Greeting(props) { | |
return <h1>{props.greeting}</h1>; | |
} | |
// JavaScript ES6 arrow function | |
const Greeting = (props) => { | |
return <h1>{props.greeting}</h1>; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Counter extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
counter: 0, | |
}; | |
this.onIncrement = this.onIncrement.bind(this); | |
this.onDecrement = this.onDecrement.bind(this); |
OlderNewer