UNPKG

@wordpress/data

Version:
43 lines 1.33 kB
export declare const Context: import("react").Context<import("../..").DataRegistry>; declare const Provider: import("react").Provider<import("../..").DataRegistry>; /** * A custom React context consumer exposing the provided `registry` to * children components. Used along with the RegistryProvider. * * You can read more about the React context API here: * https://react.dev/learn/passing-data-deeply-with-context#step-3-provide-the-context * * @example * ```js * import { * RegistryProvider, * RegistryConsumer, * createRegistry * } from '@wordpress/data'; * * const registry = createRegistry( {} ); * * const App = ( { props } ) => { * return <RegistryProvider value={ registry }> * <div>Hello There</div> * <RegistryConsumer> * { ( registry ) => ( * <ComponentUsingRegistry * { ...props } * registry={ registry } * ) } * </RegistryConsumer> * </RegistryProvider> * } * ``` */ export declare const RegistryConsumer: import("react").Consumer<import("../..").DataRegistry>; /** * A custom Context provider for exposing the provided `registry` to children * components via a consumer. * * See <a href="#registryconsumer">RegistryConsumer</a> documentation for * example. */ export default Provider; //# sourceMappingURL=context.d.ts.map