React Gotchas

#Reactjs Gotchas interesting read

  • If you’re using JSX (and most people are), the components you write must begin with an uppercase letter.
  • They’ll also get called whenever props change – so if you absolutely want to respond only to state changes, use the callback approach.
  • setState({name: ‘ Joe’ }, function () { // called after state has been updated // and the component has been re-rendered });
  • The means using names like UserList and Menu and SubmitButton , and not using names like userList , menu , and submitButton .
  • Another alternative is to use the componentWillUpdate or componentDidUpdate lifecycle hooks, which will be called immediately before and after rendering in response to your state change.

Read the full article, click here.


@devlife411: “#Reactjs Gotchas interesting read”


React Gotchas; Author: Dave Ceddia; Updated: 4 Jul 2016; Section: Client side scripting; Chapter: Web Development; Updated: 4 Jul 2016


React Gotchas