Skip to content

Instantly share code, notes, and snippets.

@santi698
Created May 22, 2019 17:59
Show Gist options
  • Save santi698/a773e14c30a4871ff02925fab4bb3823 to your computer and use it in GitHub Desktop.
Save santi698/a773e14c30a4871ff02925fab4bb3823 to your computer and use it in GitHub Desktop.
Question 1
/** * 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