Hard
Here is a component supposed to display a counter which increments when the button is clicked.
class Counter extends React.Component{
constructor(){
this.state={counter: 0};
}
increment(){
this.setState({
counter: this.state.counter++
});
}
render(){
return(
<div>
<p>{this.state.counter}</p>
<button onClick={this.increment}>INCREMENT</button>
</div>
);
}
}
What is(are) the problem(s)?
Author: Victor SabatierStatus: PublishedQuestion passed 1422 times
Edit
2
Community EvaluationsNo one has reviewed this question yet, be the first!
2
Write the missing code to render the children of the UserProfile component.5
How to submit a form in React2
Write a React component as a function3
Fix the following React component: Scroller6
Optimize a React component by implementing shouldComponentUpdate7
Improve this React component so that it displays "Green" by default.6
Write a React function that fetches comments and passes them to a component.