Skip to content

Instantly share code, notes, and snippets.

@behnamazimi
Created March 4, 2019 08:05
Show Gist options
  • Save behnamazimi/2d7688da6999c11bacf30abf98e6b369 to your computer and use it in GitHub Desktop.
Save behnamazimi/2d7688da6999c11bacf30abf98e6b369 to your computer and use it in GitHub Desktop.
Use Functional Components
// 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