Be Aware of Stale Closures when Using React Hooks

added by JavaScript Kicks
10/25/2019 8:13:02 AM

410 Views

Hooks replace class-based components by easying the reuse of state and side effects management. Additionally you can extract repeated logic into a custom hook to reuse across the application. Hooks heavily rely on JavaScript closures. But closures are sometimes tricky (recall memory leaks?).


0 comments