c05605fddf
* Update husky from 4 to 7 * Update @types/jest from 26 to 27 * Update lint-staged from 10 to 12 * Update babel-jest from 26 to 27 * Update @typescript-eslint/eslint-plugin from 4 to 5 * Update @typescript-eslint/parser from 4 to 5 * Update chalk from 4 to 5 * Update concurrently from 5 to 7 * Update stylelint from 9 to 14 and stylelint-config-wordpress from 13 to 17 * Update @wordpress/prettier-config from 0.4 to 1.1 * Update eslint from 7 to 8, @wordpress/eslint-plugin from 8 to 10, eslint-plugin-testing-library to 5 * Fix lint errors after updating eslint-plugin-testing-library * Fix style lint * Rename .stylelintrc.json -> stylelint.config.js & add todo comment Fix stylelint.config.js * Remove @wordpress/e2e-test-utils * Add changelogs for eslint-plugin * Update storybook/preview.js since addDecorator has been deprecated Remove parameters * Import directly from @storybook/addon-docs * Migrate some stories to use @storybook/addon-controls Add a comment for @storybook/addon-knobs * Update changelogs * Update preview.js to fix lint warning * Update pnpm-lock.yaml * Fix eslint layout errors (https://github.com/woocommerce/woocommerce-admin/pull/8484) |
||
---|---|---|
.. | ||
src | ||
typings | ||
.npmrc | ||
CHANGELOG.md | ||
README.md | ||
jest.config.json | ||
package.json | ||
tsconfig-cjs.json | ||
tsconfig.json |
README.md
Data
WooCommerce Admin data store and utilities.
Installation
Install the module
pnpm install @woocommerce/data --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 { SETTINGS_STORE_NAME } from '@woocommerce/data';
import { useSelect } from '@wordpress/data';
function MySettings() {
const settings = useSelect( select => {
return select( SETTINGS_STORE_NAME ).getSettings();
} );
return (
<ul>
{ settings.map( setting => (
<li>{ setting.name }</li>
) ) }
</ul>
);
}
// Rendered in the application:
//
// <MySettings />