0 votes
in ReactJS by
What is the recommended ordering of methods in component class?

1 Answer

0 votes
by

Below is the Recommended ordering of methods from mounting to render stage:

  • static methods
  • constructor()
  • getChildContext()
  • componentWillMount()
  • componentDidMount()
  • componentWillReceiveProps()
  • shouldComponentUpdate()
  • componentWillUpdate()
  • componentDidUpdate()
  • componentWillUnmount()
  • click handlers or event handlers like onClickSubmit() or onChangeDescription()
  • getter methods for render like getSelectReason() or getFooterContent()
  • optional render methods like renderNavigation() or renderProfilePicture()
  • render()

Related questions

0 votes
asked Oct 28, 2023 in ReactJS by DavidAnderson
0 votes
asked Nov 26, 2019 in ReactJS by AdilsonLima
...