Skip to content

Variable: ActorProvider

API / @xmachines/play-solid / ActorProvider

const ActorProvider: Component<ActorProviderProps>;

Defined in: packages/play-solid/src/ActorProvider.tsx:238

The ActorProvider component. It owns the actor bridge, the atom subscription, the StateStore lifecycle, the resolution of the handlers, and the error boundary.

D-11: this component replaces the old raw alias ActorProvider = ActorContext.Provider. A consumer with an <ActorProvider value={actor}> element takes <ActorContext.Provider value={actor}> now, for the raw access to the provider. That consumer can also move to this component, or to PlayUIProvider.

Example

import { ActorProvider, PlayRenderer, usePlayView } from "@xmachines/play-solid";
import { JSONUIProvider } from "@xmachines/json-render-solid";
// PlayRenderer needs the providers of json-render around it. PlayUIProvider adds them.
// A custom composition hands JSONUIProvider the store of the view context.
const MyProviders = (props: { children: JSX.Element }) => {
const view = usePlayView();
return (
<JSONUIProvider registry={view.registry} handlers={view.handlers} store={view.store}>
{props.children}
</JSONUIProvider>
);
};
<ActorProvider actor={myActor} registryResult={registryResult}>
<MyProviders>
<PlayRenderer />
</MyProviders>
</ActorProvider>;