@blockhandbook/data

Utilities that make it easier to manage state for WordPress plugins built for the block editor.

Usage no npm install needed!

<script type="module">
  import blockhandbookData from 'https://cdn.skypack.dev/@blockhandbook/data';
</script>

README

Data utilities & components for building WordPress block editor plugins

A library of utilities & components that make it easier to manage state for WordPress plugins built for the block editor.

Installation

npm i @blockhandbook/data --save-dev

This package assumes that your code will run in an ES2015+ environment.
This package assumes you are using the @wordpress/scripts package.

Components

withPosts()

Grabbing post data to create dynamic blocks is kinda complicated. The withPosts() Higher Order Component (HOC) makes it a breeze to grab WordPress post type data.

withPosts() bundles the getEntityRecords, getMedia, & getAuthors data store selectors to return an array of post data ( content, title, url, etc. ) as well as post featured media and author data.