Created
May 31, 2019 21:08
-
-
Save krfong916/ffad566aaf372a702cd340628e87607b to your computer and use it in GitHub Desktop.
A document detailing the tradeoffs we make in each of the ways that we can create components in React
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
// Component class | |
class Car extends Component { | |
constructor ( props ) { | |
super(); | |
this.propertyA = this.propertyA.bind( this ); | |
this.propertyB = this.propertyB.bind( this ); | |
} | |
} | |
class ShoppingItem extends Component { | |
state = {} | |
render () { | |
return ( | |
); | |
} | |
} | |
// | |
const Car = () => { | |
} | |
// Functional component | |
function Car = () => { | |
} | |
const Car = function () { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Component class
Explain
super()
keyword + constructor()Functional Component
Hard-core Component creation