Socket
Book a DemoInstallSign in
Socket

@automattic/data-stores

Package Overview
Dependencies
Maintainers
53
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@automattic/data-stores

Calypso Data Stores.

3.1.2
latest
Source
npmnpm
Version published
Weekly downloads
1.4K
-9.78%
Maintainers
53
Weekly downloads
 
Created
Source

Calypso Data Stores

This package contains a collection of @wordpress/data-based stores that can be used to fetch data from various WordPress.com REST API endpoints.

It is meant to be helpful for projects developed inside the Calypso monorepo that don't want to use Calypso's (monolithic) Redux state tree.

Usage

To use stores from the package, import the store object and use it directly. The store will be registered on import.

import { ProductsList } from '@automattic/data-stores';
import { useSelect } from '@wordpress/data';

export const RenderProducts = ( { url } ) => {
	const { productsList } = useSelect(
		( select ) => ( {
			productsList: select( ProductsList.store ).getProductsList(),
		} ),
		[]
	);

	return (
		<ul>
			{ Object.entries( productsList?.data ?? {} ).map( ( [ productSlug, product ] ) => (
				<li key={ productSlug }>
					Name: { product.name }
				</li>
			) ) }
		</ul>
	);
};

Types

The stores in this package are written in TypeScript, and type definitions are generated as part of the build process. If you import and use the store object directly (instead of using the string-based store name), you'll get automatic type inference.

For example:

autocomplete

Old registration method

Some stores have not yet been migrated to use the new registration method. To use these stores, you must register them manually.)

import { FooStore } from '@automattic/data-stores';
import { useSelect } from '@wordpress/data';

const FOO_STORE = FooStore.register();

export const Foo = () => {
	const foo = useSelect( ( select ) => select( FOO_STORE ).getFoo() );
	return <span>{ foo }</span>;
};

FAQs

Package last updated on 21 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.