JSPM

@wordpress/compose

2.0.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 196413
  • Score
    100M100P100Q164996F
  • License GPL-2.0-or-later

WordPress higher-order components (HOCs).

Package Exports

  • @wordpress/compose

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@wordpress/compose) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Compose

The compose package is a collection of handy Higher Order Components (HOCs) you can use to wrap your WordPress components and provide some basic features like: state, instance id, pure...

Installation

Install the module

npm install @wordpress/compose --save

This package assumes that your code will run in an ES2015+ environment. If you're using an environment that has limited or no support for ES2015+ such as lower versions of IE then using core-js or @babel/polyfill will add support for these methods. Learn more about it in Babel docs.

Usage

import { withInstanceId } from '@wordpress/compose';

function WrappedComponent( props ) {
    return props.instanceId;
}

const ComponentWithInstanceIdProp = withInstanceId( WrappedComponent );

Refer to each Higher Order Component's README file for more details.



Code is Poetry.