Home > Blockchain >  Why, after clicking the button "update State" the state inside the super doesnt update to
Why, after clicking the button "update State" the state inside the super doesnt update to

Time:08-11

In the given image below enter image description here

why, after clicking the updatestate button, doesnt update the state to sliced array that is ['usa','china'] but instead updates to entire array in console.log, Yet on the page it shows it correctly.?

CodePudding user response:

Lines 10 and 11 are called mutating states, which goes against React's recommended way to update the state, so it may or may not work.

  • Related