Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

React.js setState on page load not working, how to fix

this.setState((prevState)=> ({
  ...prevState,
  options:{ ...prevState.options,
            labels: this.props.total.map(a=>a.name)
          }
}))
 
PREVIOUS NEXT
Tagged: #setState #page #load #fix
ADD COMMENT
Topic
Name
5+7 =