During my React assessment I was asked the question why we should use this.setState() and not just this.state.KEY = VALUE. This question stumped me...
For further actions, you may consider blocking this person and/or reporting abuse
Also setState under the covers uses
Object.assign
which let's you use partial objects like{a:10}
while this.state has{b:20}
. this.state would end up with{a:10, b:20}
.Hello!, Great article, thanks for sharing
I am also investigating these matters nowadays and recently discovered that if you have
And you are:
then, you can do:
and it works the same.
I hope it helps.
Great article! I'm currently looking for a job and while I know how to use what I know, sometimes I am not able to explain why. Thanks!!
That's a really helpful post. You have a great writing talent. Keep it up - I think that writing clear English is actually much more challenging than writing smart code!