♻️ Apply new code style to “common” store

This commit is contained in:
Philipp Stracker 2024-11-20 17:21:09 +01:00
parent 8f12e978f3
commit 7ae4184d30
No known key found for this signature in database
9 changed files with 130 additions and 109 deletions

View file

@ -3,7 +3,22 @@
*
* These encapsulate store interactions, offering a consistent interface.
* Hooks simplify data access and manipulation for components.
* Exported hooks must have unique names across all store modules.
*
* @file
*/
import { useSelect } from '@wordpress/data';
import { STORE_NAME } from './constants';
const useTransient = ( key ) =>
useSelect(
( select ) => select( STORE_NAME ).transientData()?.[ key ],
[ key ]
);
const usePersistent = ( key ) =>
useSelect(
( select ) => select( STORE_NAME ).persistentData()?.[ key ],
[ key ]
);