You get a bonus - 1 coin for daily activity.
Now you have 1 coin
What happens if you use setState() in the constructor? in REACT
Practice
When you use
setState()
, then, apart from assigning to the state object, React also re-renders the component and all of its children. You will get an error similar to this: only a mounted or mounting component can be updated. So we need to use
this.state
to initialise variables inside the constructor.
Comments
To leave a comment
If you have any suggestion, idea, thanks or comment,
feel free to write. We really value feedback and are glad to hear your opinion.
Comments