JavaScript Packages

Core @wordpress/* JavaScript packages bundled with WordPress.

Source: wp-includes/js/dist/

Packages

PackageDescription
blocks.mdBlock registration and serialization
block-editor.mdBlock editor components
components.mdReusable UI components
data.mdRedux-like data store
element.mdReact abstraction layer
hooks.mdJavaScript hooks (actions/filters)
api-fetch.mdREST API client
i18n.mdInternationalization
url.mdURL manipulation utilities
dom-ready.mdDOM ready handler
scripts.mdScript loading utilities

Usage

js
import { registerBlockType } from '@wordpress/blocks';
import { useSelect } from '@wordpress/data';
import { Button } from '@wordpress/components';

wp.* Global

All packages are also available on the global wp object:

js
wp.blocks.registerBlockType( ... );
wp.data.select( 'core' ).getCurrentUser();
wp.element.createElement( 'div', null, 'Hello' );