Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think the problem is (not in particularly you) that people want apples to apples comparison.

There is no equivalent of lifecycle in hooks! Sure you can give some example of how to produce a componentDidMount, but that defeats the point of hooks.

The hooks api is designed to focus on dependencies and what to do in case a dependency changes. When there is an empty array as a dependency , that implies that this hook will never rerun as it has no dependency. Similarly, if there is one dependency, the hook will rerun when that dependency changes.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: