Concerning the newly proposed https://reactjs.org/docs/hooks-reference.html#useeffect
- What are the advantages and use cases of the Effect hook (useEffect())?
- Why would it be preferable & how does it differ over componentDidMount/componentDidUpdate/componentWillUnmount (performance/readability)?
The documentation states that:
Mutations, subscriptions, timers, logging, and other side effects are not allowed inside the main body of a function component (referred to as React’s render phase).
but I think it was already common knowledge to have these behaviors in lifecycle methods like componentDidUpdate, etc. instead of the render method
There's also the mention that:
The function passed to useEffect will run after the render is committed to the screen.
but isn't that what componentDidMount & componentDidUpdate do anyways?
I think you can use functional component for literally everything. And even if you can't using traditional react, you can use some npm packages to achieve what you are trying to do. Moreover functional components are more organized and cleaner than the class components. I will bet my money on functional components.