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(name){ | |
this.name = name; | |
} | |
hello(){ | |
return 'Hello World! I am ' + this.name + ' and I am a web developer'; | |
} | |
} |
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
var nathan = new Developer('Nathan'); | |
nathan.hello(); // Hello World! I am Nathan and I am a web developer |
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 ReactDeveloper extends Developer { | |
installReact(){ | |
return 'installing React .. Done.'; | |
} | |
} | |
var nathan = new ReactDeveloper('Nathan'); | |
nathan.hello(); // Hello World! I am Nathan and I am a web developer | |
nathan.installReact(); // installing React .. Done. |
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 ReactDeveloper extends Developer { | |
installReact(){ | |
return 'installing React .. Done.'; | |
} | |
hello(){ | |
return 'Hello World! I am ' + this.name + ' and I am a REACT developer'; | |
} | |
} |
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 { | |
// class content | |
render(){ | |
return ( | |
<h1>Hello React!</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
const name = "David"; | |
let age = 28; | |
var occupation = "Software Engineer"; |
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 { | |
// class content | |
render(){ | |
const greeting = 'Welcome to React'; | |
return ( | |
<h1>{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
// regular function | |
const testFunction = function() { | |
// content.. | |
} | |
// arrow function | |
const testFunction = () => { | |
// content.. | |
} |
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
const testFunction = (firstName, lastName) => { | |
return firstName+' '+lastName; | |
} | |
const singleParam = firstName => { | |
return firstName; | |
} |
OlderNewer