woocommerce/packages/woocommerce-blocks/assets/js/blocks/cart-checkout/cart-i2/context.ts
2021-12-10 12:03:04 +00:00

20 lines
414 B
TypeScript

/**
* External dependencies
*/
import { createContext, useContext } from '@wordpress/element';
/**
* Context consumed by inner blocks.
*/
export type CartBlockContextProps = {
currentView: string;
};
export const CartBlockContext = createContext< CartBlockContextProps >( {
currentView: '',
} );
export const useCartBlockContext = (): CartBlockContextProps => {
return useContext( CartBlockContext );
};