Skip to main content

ProviderTree

Callable

  • ProviderTree<Providers>(__namedParameters: { children: ReactNode; providers: { [ K in string | number | symbol ]: [provider: JSXElementConstructor<Providers[K]>, props?: Omit<NoInfer<Providers[K]>, children>] } }): ReactNode

  • Creates a provider tree with the given providers and children.

    @throws

    When there are no providers provided.

    @example
    <ProviderStack
    providers={[
    [StrictMode],
    [ThemeProvider, { theme: 'dark' }]
    ]}
    >
    <App />
    </ProviderStack>

    Type parameters

    • Providers: [ContainsChildren, ...ContainsChildren[]]

    Parameters

    • __namedParameters: { children: ReactNode; providers: { [ K in string | number | symbol ]: [provider: JSXElementConstructor<Providers[K]>, props?: Omit<NoInfer<Providers[K]>, children>] } }

    Returns ReactNode

    The provider tree with the given providers and children.