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 […]
Often with any sort of state in a given application, there can be times in an application’s lifecycle where you want to be able to execute some sort of logic as a part of the flow in setting state or updating state. A good example of this is asynchronous data flows between the client and […]
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 […]
An introduction to the useDispatch and useSelect hooks exposed via the wp.data api of the new WordPress editor.
(Edit October 10, 2018) Note: This article is now out of date but is kept published for reference purposes. Nearly everything in Gutenberg is published as a package so for the purpose of testing you can include those packages as a devDependency in your package.json file and jest will know to reference those in tests. As a […]
A few months ago, one of the teams I work with went on the hunt for a good continuous integration service for running tests on the code we write. We jumped on the unit test bandwagon at the beginning of the year and wanted to really amp up the quality of our product by having tests […]
I thought I was following the development of WordPress 3.7 fairly closely but something totally missed my notice and only caught my attention when a plugin I develop stopped working with the latest version of WordPress. The culprit? do_action( ‘save_post’, $post_ID, $post, $update ); Notice anything different? The difference is that this hook used to only have […]
I got really intrigued with the wp-cli tool for command line WordPress (seriously awesome, check it out)… however I haven’t switched my osx machine to use the built in php and mysql so I kept getting this error: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) Easy fix: sudo ln […]