As we know in react, only class compnt can get access to lifecycle method such as componentDidMount...
Is that true? Not really. Because in theory, functional compont is just like class compnt., it will eventually render in client browser. If that is the case, it does will get access to the DidMount method.
It is proven by the recent release of react hooks, where you can use useSideEffect on functional compnt.
solution: use this library, to add lifecycles to functional compont.
link: github.com/planttheide…
Offcourse, you can always use HOOKS.