Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to update state in react

// Correct
this.setState(function(state, props) {
  return {
    counter: state.counter + props.increment
  };
});
Source by reactjs.org #
 
PREVIOUS NEXT
Tagged: #update #state #react
ADD COMMENT
Topic
Name
2+1 =