Created
March 4, 2019 08:05
-
-
Save behnamazimi/2d7688da6999c11bacf30abf98e6b369 to your computer and use it in GitHub Desktop.
Use Functional Components
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
// Dirty Code | |
clas MyComponent extends Component { | |
render(){ | |
return 'This is my Class Component' | |
} | |
} | |
// Clean Code | |
const MyComponent = (props) => { | |
return 'This is my Functional Component' | |
} | |
// More Clean Code | |
const MyComponent = (props) => ( | |
'This is my Functional Component' | |
) | |
// Double Clean Code (for this component) | |
const MyComponent = (props) => 'This is my Functional Component' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment