Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

change dictionary value in React js

handleChange(event) {
    // get name and value properties from event target
    const {name, value} = event.target
    this.setState(prevState => ({
        // update your 'list' property
        list: {
          // spread old values into this object so you don't lose any data
          ...prevState.list,
          // update this field's value
          [name]: value
        }
    }))
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #change #dictionary #React #js
ADD COMMENT
Topic
Name
7+8 =