Created
May 22, 2019 17:59
-
-
Save santi698/a773e14c30a4871ff02925fab4bb3823 to your computer and use it in GitHub Desktop.
Question 1
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
/** * What is wrong with this example, and how would you go | |
* about fixing or improving the component? | |
*/ | |
class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
name: this.props.name || 'Anonymous' | |
} | |
} | |
render() { | |
return ( | |
<p>Hello {this.state.name}</p> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment