What is the recommended ordering of methods in component class?
Recommended ordering of methods from mounting to render stage:
static
methodsconstructor()
getChildContext()
componentWillMount()
componentDidMount()
componentWillReceiveProps()
shouldComponentUpdate()
componentWillUpdate()
componentDidUpdate()
componentWillUnmount()
- click handlers or event handlers like
onClickSubmit()
oronChangeDescription()
- getter methods for render like
getSelectReason()
orgetFooterContent()
- optional render methods like
renderNavigation()
orrenderProfilePicture()
render()
January 12, 2022
509
Read more
What is React?
November 06, 2022
ReactJSHow to programmatically trigger click event in React?
November 06, 2022
ReactJS