@proxydi/react
Version:
React wrapper for the ProxyDi library
20 lines (19 loc) • 1.03 kB
TypeScript
import React, { ReactNode } from 'react';
import { ProxyDiContainer } from 'proxydi';
interface ProxyDiProviderProps {
children: ReactNode;
init?: (container: ProxyDiContainer) => void;
container?: ProxyDiContainer;
}
/**
* Provides a ProxyDi container to its child components.
* If a container is not provided (the recommended usage), a new container will be created.
* If this provider is nested within another ProxyDiProvider,
* the newly created container will be a child of the container from the parent ProxyDiProvider.
*
* @param {Function} [props.init] - Function to initialize the container's dependencies. This is the recommended way to register dependencies in the container.
* @param {ProxyDiContainer} [props.container] - An alternative, though not recommended, way to provide an initialized container instance.
* @param {React.ReactNode} props.children - Child components that will have access to the container.
*/
export declare const ProxyDiProvider: React.FC<ProxyDiProviderProps>;
export {};