This file contains hidden or 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 Person { | |
| name = 'Abel'; //no need for the constructor | |
| //new way of defining the methods | |
| const printMyName = () => { | |
| console.dir(this.name); | |
| } | |
| } |
This file contains hidden or 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 functionOne() { | |
| // Some code | |
| } | |
| var functionTwo = function() { | |
| // Some code | |
| }; |
This file contains hidden or 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 functionTwo = function() { | |
| // Some code | |
| }; |
This file contains hidden or 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 functionTwo = () => { | |
| // Some code | |
| }; |
This file contains hidden or 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
| //more than one parameter | |
| const functionTwo = (param1, param2) => { | |
| // Some code | |
| }; | |
| //only one parameter | |
| const functionTwo = (param1) => { | |
| // Some code | |
| }; |
This file contains hidden or 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 sum = (param1, param2) => { | |
| return param1 + param2 | |
| } | |
| /** | |
| *We can easily just remove the {} | |
| *and rewrite as | |
| */ | |
| const sum = (param1, param2) => param1 + param2; |
This file contains hidden or 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 myComponent = () => ( | |
| <div> | |
| Some Jsx return | |
| </div> | |
| ); | |
| export default myComponent; |
This file contains hidden or 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> | |
| Something is return sha | |
| </div> | |
| ); |
This file contains hidden or 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 './App.css'; | |
| class App extends Component { | |
| render() { | |
| return ( | |
| <div className={App}> | |
| <h1>Hi, I am a React App</h1> | |
| </div> |
This file contains hidden or 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 from 'react'; | |
| import './App.css'; | |
| const App = () => { | |
| return ( | |
| <div className={App}> | |
| <h1>Hi, I am a React App</h1> | |
| </div> | |
| ); | |
| } |