What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-24 17:58:02
Updating an object with setState in React
this.setState(prevState => { let jasper = Object.assign({}, prevState.jasper); // creating copy of state variable jasper jasper.name = 'someothername'; // update the name property, assign a new value return {... Add solution