Answer the question
In order to leave comments, you need to log in
At what point in the lifecycle should the state be updated?
Good afternoon. The task on React is to implement the following logic:
In state, a defined field is null by default. When the page is loaded, the function is launched and checks if it is null, then it creates a field, if it has already been created, it returns it. For placing such a function in the render method, react swears, because I use setState in render. I assume that state needs to be filled before rendering, in a certain life cycle. Please tell me which one.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question