Answers for "react native update state object inside object"

1

react native update state object inside object

this.setState(prevState => ({
   ...prevState,
    jasper: {                   // object that we want to update
        ...prevState.jasper,    // keep all other key-value pairs
        name: 'something'       // update the value of specific key
    }
}))
Posted by: Guest on May-28-2021

Code answers related to "react native update state object inside object"

Code answers related to "Javascript"

Browse Popular Code Answers by Language