provider
function provider<TProps>(Provider, ...args): ProviderSpec;Defined in: providers.tsx:55
Create a typed ProviderSpec tuple with prop inference and required-prop enforcement.
- If a provider has required props (excluding
children), the props argument is required. - If a provider has no props (excluding
children), the props argument is optional and rejects extra keys.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
TProps extends AnyProps |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
Provider |
ComponentType<TProps> |
The React component to use as a provider. |
…args |
ProviderPropsArg<TProps> |
Props to pass to the provider (excluding children). |
Returns
Section titled “Returns”A ProviderSpec tuple.
Example
Section titled “Example”import { provider, Providers } from "@xtandard/lib/react";
// Provider with required propsprovider(ThemeProvider, { theme: "dark" })
// Provider with no props (optional)provider(PermissionsProvider)