Skip to content

Function: createPlayRouterProvider()

API / @xmachines/play-tanstack-solid-router / createPlayRouterProvider

function createPlayRouterProvider<TRouter>(BridgeCtor): <TActor>(props) => any;

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

Create a Solid PlayRouterProvider component bound to a specific bridge class.

The returned component connects a PlayerActor to the framework 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.

Type Parameters

Type Parameter
TRouter

Parameters

ParameterTypeDescription
BridgeCtorPlayRouterBridgeConstructor<TRouter>Bridge class constructed as new BridgeCtor(router, actor, routeMap).

Returns

A PlayRouterProvider component, generic over the actor type so the renderer callback receives the same concrete actor type that was passed in.

<TActor>(props) => any

Example

export const PlayRouterProvider = createPlayRouterProvider(TanStackSolidRouterBridge);