Skip to content

Instantly share code, notes, and snippets.

@uladzislau-stuk
Last active November 7, 2019 20:38
Show Gist options
  • Save uladzislau-stuk/6970071b024a2b617dacab2c3ed92f70 to your computer and use it in GitHub Desktop.
Save uladzislau-stuk/6970071b024a2b617dacab2c3ed92f70 to your computer and use it in GitHub Desktop.
[React Best practices] #react#bestpractices

setState func syntax

  • state is a reference to the component state at the time the change is being applied
  • use if the next state depends on the current state
this.setState((state, props) => {
  return {counter: state.counter + props.step};
})

Great articles

Comprehensive react-redux-links

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment