in React JS by
Q:

What's wrong with the following code?

1 Answer

0 votes
by

this.setState{(prevState, props)=>

{

return {

streak: prevState.streak+props.count

}

})

Nothing isn't right with it. It's once in a while utilized and not outstanding, but rather you can likewise pass a function to setState that gets the past state and props and returns another state, similarly as we're doing above. Furthermore, is nothing amiss with it, as well as effectively recommended in case you're setting state in light of the previous state.

Click here to read more about React JS
Click here to read more about Insurance

Related questions

0 votes
asked Jun 11, 2020 in C Plus Plus by Robindeniel
0 votes
asked Apr 29, 2020 in React JS by Hodge
0 votes
asked Jan 31, 2020 in Selenium by SakshiSharma
+1 vote
asked May 23, 2020 in Python by sharadyadav1986
+1 vote
asked Jan 19 in Python by SakshiSharma
...