Skip to content

Interface: PlayRouterProviderProps<TActor>

API / @xmachines/play-react-router / PlayRouterProviderProps

Defined in: play-react-router/src/play-router-provider.tsx:27

The props of the PlayRouterProvider of React Router.

router is the React Router instance that createBrowserRouter returns. PlayRouterProviderBaseProps holds the requirement of a stable reference for actor, for router, and for routeMap.

Extends

Type Parameters

Type ParameterDefault type
TActor extends PlayActorPlayActor

Properties

PropertyTypeDescriptionInherited fromDefined in
actorTActorThe actor to keep in step with the router. It must be a stable reference: give the same actor instance on every render. An actor in the JSX, or a new actor on each render, makes the bridge disconnect and connect again each time.PlayRouterProviderBaseProps.actorplay-react-router/src/create-play-router-provider.tsx:40
renderer(actor, router) => ReactNodeThe renderer callback receives the same concrete actor type as the prop.PlayRouterProviderBaseProps.rendererplay-react-router/src/create-play-router-provider.tsx:57
routeMapRouteMapThe route map of both directions, for the lookup between a state ID and a URL path. It must be a stable reference. The provider builds the bridge again on each change of the identity of routeMap. A value in the JSX, for example createRouteMapFromTree(routeTree), makes a new object on every render, and the bridge therefore connects again on every render. Hold the value with useMemo: const routeMap = useMemo(() => createRouteMapFromTree(routeTree), [routeTree]);PlayRouterProviderBaseProps.routeMapplay-react-router/src/create-play-router-provider.tsx:55
routerRouterThe router instance that the bridge keeps in step with the actor. It must be a stable reference.PlayRouterProviderBaseProps.routerplay-react-router/src/create-play-router-provider.tsx:42