@wordpress/data
is a state management library for JavaScript. It is used in the WordPress admin, and is available as a package in the WordPress npm registry.
- Requires Node.js v16 and npm v8.
npm install
to install dependencies.npm start
to start the development server.
View the cheatsheet for a quick reference of terminology.
View the learnup for a detailed explanation of the concepts and API. This is a Marp presentation, so you can view it in Marp or Marp for VS Code.
The @wordpress/data
implementation of state management for @aprea's TicTacToe app is available in the src/data directory. Some modifications and additions were made to the component structure to resemble a large-scale app.
Check out the controls-resolvers
branch to see additional players
state with async selectors and resolvers.
- I strongly recommend reading A Practical Overview of the @wordpress/data API by @nerrad.