woocommerce/packages/js/data
Christopher Allford b7931409f2
Migrate From Nx to Turborepo (#33079)
This replaces all `nx` commands with `turbo` commands and removes Nx from the repository. All of the `project.json` files have been removed and any commands that broke with Turborepo have been adjusted.
2022-06-09 14:40:07 -07:00
..
changelog Add create product actions in products data store (#33278) 2022-06-07 09:23:27 -04:00
src Add create product actions in products data store (#33278) 2022-06-07 09:23:27 -04:00
typings Reformat ./data/typings/index.d.ts 2022-04-26 09:32:52 +08:00
.eslintrc.js Add .eslintrc config to each packages 2022-03-29 16:08:07 +08:00
.npmrc Moved WCA Packages 2022-03-18 14:25:26 -07:00
CHANGELOG.md Add changelog 2022-05-09 11:31:03 -03:00
README.md Moved WCA Packages 2022-03-18 14:25:26 -07:00
composer.json Set Composer Platform Requirements (#33245) 2022-05-27 14:57:33 -07:00
composer.lock Set Composer Platform Requirements (#33245) 2022-05-27 14:57:33 -07:00
jest.config.json Prefixed Private JS Packages (#33218) 2022-05-31 15:42:00 -07:00
package.json Migrate From Nx to Turborepo (#33079) 2022-06-09 14:40:07 -07:00
tsconfig-cjs.json Added EOF Newlines 2022-05-10 13:35:31 -07:00
tsconfig.json Add Typescript type declarations for js packages 2022-04-15 13:50:17 +08:00

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 />