Introduction to Preact Hooks
Hooks provide an alternative to class components, allowing you to extract stateful logic and side effects into reusable functions. Hooks rely on closures rather than the
this keyword, eliminating many stale data problems associated with asynchronous state updates. Hooks can be imported from preact/hooks or preact/compat.