Andrew's Digital Garden

React Hooks pattern

Not really a design pattern, but I'll put it here anyway.

Use functions to reuse stateful logic among multiple components throughout the app

The introduction of Hooks mean you no longer need a class component to access lifecycle events.

This opened up a whole new world of possibilities. Previously where you would share data or keep things [[20200307105301-dry]] with Higher Order Components (HOCs) or [[20221205104221-render-props-pattern]], you can now refactor to achieve similar with Hooks.

[[designpatterns]] [[react]]

React Hooks pattern