Where you want to place componentDidMount and componentDidUpdate?

where it is necessary to place these components in a container or directly in the component that does the rendering?
March 19th 20 at 08:47
3 answers
March 19th 20 at 08:49
Solution
In the component that you draw.
March 19th 20 at 08:51
Forget this ridiculous separation of duties. —ĀomponentDidMount and componentDidUpdate only hooks lifecycle to be applied where there is a need to use them.
March 19th 20 at 08:53
Since React v16.8 recommended React Hooks to create new components.
In your case you should use useEffect Hook.
More about this you can read on the official website of React:
https://reactjs.org/docs/hooks-effect.html
In the documentation it is recommended only to try the hooks in the new code. Classes aren't going anywhere. What hooks will be the main way of writing components is expected only in the very long term. - Maya.Becker commented on March 19th 20 at 08:56

Find more questions by tags ReduxReact