Skip to content

Variable: ActorProvider

API / @xmachines/play-react / ActorProvider

const ActorProvider: React.FC<ActorProviderProps>;

Defined in: packages/play-react/src/ActorProvider.tsx:288

ActorProvider — the low-level provider that composes the actor lifecycle with your own providers.

It subscribes to the actor.currentView atom. It manages the StateStore lifecycle of each view. It wraps the children in StateProvider and in PlayErrorBoundary. It also puts onRenderError into the component registry.

Standard use: prefer , and use this component only when you compose the providers yourself.

Example

// A custom composition. Hand JSONUIProvider the store of the view context: without
// it, JSONUIProvider makes an empty store of its own, which holds no /context.
function MyProviders({ children }: { children: React.ReactNode }) {
const view = usePlayView();
return (
<JSONUIProvider registry={view.registry} handlers={view.handlers} store={view.store}>
{children}
</JSONUIProvider>
);
}
<ActorProvider actor={actor} registryResult={registryResult}>
<MyProviders>
<PlayRenderer />
</MyProviders>
</ActorProvider>
// Standard use: prefer PlayUIProvider
<PlayUIProvider actor={actor} registryResult={registryResult}>
<PlayRenderer />
</PlayUIProvider>