Login
Remember
Register
Ask a Question
What is the recommended ordering of methods in component class?
0
votes
asked
Feb 24, 2021
in
ReactJS
by
SakshiSharma
What is the recommended ordering of methods in component class?
#order-method
reactjs-order
component-class
component-class-order
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Feb 24, 2021
by
SakshiSharma
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()
...