Skip to content

Function: PlayRouterProvider()

API / @xmachines/play-solid-router / PlayRouterProvider

function PlayRouterProvider<TActor>(props): any;

Defined in: packages/play-solid-router/src/play-router-provider.tsx:76

Connects a PlayerActor to Solid Router, keeping actor state and browser URL in sync bidirectionally.

The bridge is created synchronously at component evaluation time (Solid’s execution model) and torn down via onCleanup when the component is disposed. Unlike React, prop stability is not a concern — Solid’s props accessor is already reactive and the bridge is created once per component instance.

The router prop must be obtained from Solid Router hooks in the parent component:

function AppShell() {
const navigate = useNavigate();
const location = useLocation();
const params = useParams();
return (
<PlayRouterProvider
actor={actor}
routeMap={routeMap}
router={{ navigate, location, params }}
renderer={(a) => <PlayRenderer actor={a} registry={registry} />}
/>
);
}

Type Parameters

Type Parameter
TActor extends PlayActor

Parameters

ParameterType
propsPlayRouterProviderProps<TActor>

Returns

any