Created
June 1, 2020 23:19
-
-
Save tonymtz/0e43f13c0cd5bf1be7b2a2ec685b4ed8 to your computer and use it in GitHub Desktop.
class-based vs 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
// class-based component | |
class Text extends React.Component { | |
render() { | |
return <span>{this.props.children}</span> | |
} | |
} | |
// functional component | |
const Text = props => { | |
return <span>{props.children}</span>; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment