This example shows how to create a React app in a WordPress admin page. A detailed description of this project is available in the "How to Guide": Create your First App with Gutenberg Data (in the Block Editor Handbook)
| Example | Description | Tags | Download .zip | Live Demo |
|---|---|---|---|---|
| Data Basics - @wordpress/data | Introduction to using @wordpress/data for state management in WordPress, covering basic concepts and patterns. | no-block wp-data featured |
📦 |
The index.js defines a root React component containing the app (MyFirstApp) that is "inserted" in the DOM via createRoot of react-dom
useSelectis used to get info about the entities (pages)useDispatchis used to trigger actions over the entities (pages)- Several UI components are used from
@wordpress/components
- useEntityRecords: an easier way to fetch WordPress data | Developer Blog
- Application state managed withDispatch, withSelect and compose 101 | Developer Blog
- useSelect | Block Editor Handbook
- data module documentation | Block Editor Handbook
- WordPress API documentation | Block Editor Handbook
@wordpress/components(also see Storybook)
Note Check the Start Guide for local development with the examples