be7dd2dd5e
* Add initial payment recommendations code for the payments settings * Added request data for the recommended payments * Some styling updates and make sure it does not show when marketplace suggestions is disabled * Update url * Update comment in php class * Add tests * Fix lint errors * Remove unnecessary type * Fix lint error * Fix broken test * Convert plugin package to typescript * Fix lint errors * Add changelog * Add support for locale-data * Fix track name * Fix up the tests * Fix lint errors * Address PR feedback * Add tests for option hydration * Make types more robust in plugins reducer * Made use of SlotFill component instead of page registry and router * Removed console log, and fixed types * Add newer version of i18n to data package, for newer types * Make the request to WooCommerce.com more restrictive * Fix path of import * Update PHP with suggested changes * Remove SlotFill with applyFilters * Update copy and PR feedback * Update package lock * Updated package lock * Fix the package lock * Added dot, and some minor styling changes * Add test instructions |
||
---|---|---|
.. | ||
src | ||
.npmrc | ||
CHANGELOG.md | ||
README.md | ||
package.json |
README.md
Data
WooCommerce Admin data store and utilities.
Installation
Install the module
npm 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 />