mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
♻️ Apply new code style to “common” store
This commit is contained in:
parent
8f12e978f3
commit
7ae4184d30
9 changed files with 130 additions and 109 deletions
|
@ -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 ]
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue