WordPress Data: How to Register a Custom Store

This entry is part 3 of 15 in the series, A Practical Overview of the @wordpress/data API

The primary way in which you interact with state in wp.data is through a registered store. In this post we’re going to give an overview of the api for registering a store and then subsequent posts will dive into the specific components of the store config. registerStore( reducerKey, options ) Every data store found in […]

WordPress Data: Interfacing With the Store

This entry is part 12 of 15 in the series, A Practical Overview of the @wordpress/data API

Now that we have our new custom data store registered, we need to start integrating it with our example app. There are numerous ways in which you can interface with the data store in your components but I’m going to cover the four most common, straightforward ways. withSelect( mapToProps )( Component) withSelect is a higher […]

WordPress Data: Putting it all together and registering your store!

This entry is part 11 of 15 in the series, A Practical Overview of the @wordpress/data API

To recap: so far in the series we’ve looked at the various properties of the configuration object for a store: selectors: which interface with the store for retrieving data from its state. actions: (actually action creators) which are used to dispatch action objects for handling by the reducer. reducer: which receives dispatched actions and determines […]

WordPress Data Store Properties: Selectors

This entry is part 6 of 15 in the series, A Practical Overview of the @wordpress/data API

The job of selectors is to provide an interface to access state from the registered data store. With wp.data this is the primary way that your store state is exposed and allows you to encapsulate logic surrounding exposing that data. For instance, let’s say you just want to store all products in the store state […]

WordPress Data Series Overview and Introduction

This entry is part 1 of 15 in the series, A Practical Overview of the @wordpress/data API

For the past couple of years, my involvement with the Gutenberg project in WordPress has frequently taken me into the innards of @wordpress/data.  I’ve had to use it for projects integrating with the new WordPress Block Editor (Gutenberg), new interfaces and user experiences utilizing the new WordPress JavaScript packages, and I’ve also been directly involved […]

Into the next decade…

It’s been a while since I’ve written one of these year end, year beginning posts, but this is a significant year as the 2010’s draw to a close and the 2020’s have begun. So I figured it be a good exercise to reflect and predict. Let’s start with reflect: Reflect I’m going to group things […]