Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

object spread method

this.setState(prevState => ({
    jasper: {                   // object that we want to update
        ...prevState.jasper,    // keep all other key-value pairs
        name: 'something'       // update the value of specific key
    }
}))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #object #spread #method
ADD COMMENT
Topic
Name
2+5 =