UNPKG

@zedux/react

Version:

A Molecular State Engine for React

39 lines (38 loc) 1.26 kB
import { Ecosystem, EcosystemConfig } from '@zedux/atoms'; import React, { ReactNode } from 'react'; /** * EcosystemProvider * * If an `ecosystem` prop is passed, that ecosystem will take charge of all atom * usages below it in the component tree. * * If no `ecosystem` prop is passed, EcosystemProvider creates an atom ecosystem * and provides it. The created ecosystem will be destroyed when this * EcosystemProvider unmounts. The auto-created ecosystem can be configured with * props passed here. * * ```ts * // gives you full control over the ecosystem: * <EcosystemProvider ecosystem={ecosystem}> * * // a convenient shorthand, esp. useful in testing: * <EcosystemProvider id="root"> * ``` */ export declare const EcosystemProvider: ({ children, ecosystem: passedEcosystem, ...ecosystemConfig }: (Partial<{ atomDefaults?: undefined; complexParams?: undefined; context?: undefined; destroyOnUnmount?: undefined; flags?: undefined; id?: undefined; onReady?: undefined; overrides?: undefined; ssr?: undefined; }> & { children?: ReactNode; ecosystem?: Ecosystem<any> | undefined; }) | (Partial<EcosystemConfig<any>> & { children?: ReactNode; ecosystem?: undefined; })) => React.JSX.Element;