Put in order · JavaScript and React course · Module 3: State and Events

Updating an Object with the Spread Operator

Arrange the correct way to update a single property of an object in useState:

Items to put in order

  • setState(prev =>
  • ({
  • }))
  • name: 'new'
  • ...prev,

You can check the correct answer by solving this task in the CodeWorlds game.