from:
this part:
handleClick() {
this.setState({
counter: this.state.counter + 1 // change code here
});
}
Isn’t this supposed to be a function for result based on previous value?
like:
handleClick() {
this.setState(state => ({
....
or is there a reason it’s not necessary?
thanks
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Challenge: Render Conditionally from Props
Link to the challenge:
you can set the state to whatever you want; even a boolean. setState(true) would be allowed. You don’t need the updater argument
Typescript may stop from setting any value you want but that’s kind of getting ahead