-
Notifications
You must be signed in to change notification settings - Fork 382
Use React Hooks where appropriate #2538
Copy link
Copy link
Closed
Labels
InfrastructureChanges impacting testing infrastructure or build toolingChanges impacting testing infrastructure or build toolingIntegration: GutenbergP2Low priorityLow priority
Description
In the latest version of Gutenberg, a bunch of handy React hooks have been added, most notably useSelect and useDispatch. (see documentation). It also exposes existing hooks like useState, for example.
Specifically for AMP Stories we have added many higher-order components that over time can make code quite hard to read. We also heavily leverage the pre-existing withSelect and withDispatch HOCs.
With React hooks we have the opportunity to greatly simplify many of our custom React components to make them easier to comprehend and maintain in the long term.
Note: withSelect internally already uses that new useSelect hook, so switching to hooks directly would remove an unnecessary layer in-between.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
InfrastructureChanges impacting testing infrastructure or build toolingChanges impacting testing infrastructure or build toolingIntegration: GutenbergP2Low priorityLow priority