Skip to content

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 Parameter
TProps extends AnyProps
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).

ProviderSpec

A ProviderSpec tuple.

import { provider, Providers } from "@xtandard/lib/react";
// Provider with required props
provider(ThemeProvider, { theme: "dark" })
// Provider with no props (optional)
provider(PermissionsProvider)