Function: createPlayRouterProvider()
API / @xmachines/play-react-router / createPlayRouterProvider
function createPlayRouterProvider<TRouter>(BridgeCtor): <TActor>(__namedParameters) => Element;Defined in: play-react-router/src/create-play-router-provider.tsx:81
Create a React 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 once on mount and torn down on unmount. It is also
rebuilt if actor, router, or routeMap change identity — so all three
props must be stable references (created outside JSX or memoized).
Under React <StrictMode> the effect runs twice on mount
(connect → disconnect → connect), which the bridges support.
Type Parameters
| Type Parameter |
|---|
TRouter |
Parameters
| Parameter | Type | Description |
|---|---|---|
BridgeCtor | PlayRouterBridgeConstructor<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>(__namedParameters) => Element
Example
export const PlayRouterProvider = createPlayRouterProvider(ReactRouterBridge);