Solid.Router
- Package
- purescript-purs-solid
- Repository
- arazorda/purs-solid
Paths are parsed at compile time, so a route's component receives exactly
the params its path declares. Links are plain anchors
(H.a { href: href @"/users/:id" { id } }); the router intercepts same-origin
clicks and marks the active link with aria-current="page".
#RouteProps Source
type RouteProps :: Row Type -> Typetype RouteProps params = { children :: JSX, params :: Accessor (Record params) }
children is the matched child route (for a layout).
#RouteOptions Source
type RouteOptions :: Row Type -> Row Typetype RouteOptions params = (preload :: PreloadArgs params -> Effect Unit)
#PreloadArgs Source
type PreloadArgs :: Row Type -> Typetype PreloadArgs params = { intent :: String, params :: Record params }
intent is "initial", "navigate", "native" or "preload".
#route Source
route :: forall @path params. IsSymbol path => PathParams path params => (RouteProps params -> Setup JSX) -> Routeroute @"/users/:id<int>/:tab?" \props -> ... (optional params are Maybe).
#routeWith Source
routeWith :: forall @path params given missing. IsSymbol path => PathParams path params => Union given missing (RouteOptions params) => Record given -> (RouteProps params -> Setup JSX) -> RouteTakes any subset of RouteOptions.
#layout Source
layout :: forall @path params. IsSymbol path => PathParams path params => (RouteProps params -> Setup JSX) -> Array Route -> RouteRender the matched child with props.children. Child paths are relative
to this one.
#layoutWith Source
layoutWith :: forall @path params given missing. IsSymbol path => PathParams path params => Union given missing (RouteOptions params) => Record given -> (RouteProps params -> Setup JSX) -> Array Route -> Route#layoutLazy Source
layoutLazy :: forall @path @name params. IsSymbol path => LazyName name => PathParams path params => (RouteProps params -> Setup JSX) -> RouteA layout whose child routes load on first match, from the module name,
which exports routes :: Array Route:
layoutLazy @"/admin" @"App.Admin" render.
#browserHistory Source
browserHistory :: forall m. MonadReactive m => m History#hashHistory Source
hashHistory :: forall m. MonadReactive m => m History#memoryHistory Source
memoryHistory :: forall m. MonadReactive m => String -> m HistoryStarts at the given URL.
#createRouter Source
createRouter :: forall m given missing. MonadReactive m => Union given missing RouterOptions => { routes :: Array Route | given } -> m RouterThe route tree is fixed. Takes routes and any subset of RouterOptions.
Works in Effect or Setup.
#locationState Source
locationState :: Location -> Accessor (Maybe Json)The state the navigation passed, if any.
#useIsRouting Source
useIsRouting :: Setup (Accessor Boolean)true while a navigation (and the next route's data) is in progress.
#usePreloadRoute Source
usePreloadRoute :: Setup (String -> Effect Unit)Loads a URL's route code and data ahead of navigating there.
#useBeforeLeave Source
useBeforeLeave :: (BeforeLeave -> Effect Unit) -> Setup UnitRe-exports from Solid.Router.Path
- Modules
- Solid.
Action - Solid.
Async - Solid.
Component - Solid.
Component. JS - Solid.
Context - Solid.
Control - Solid.
DOM - Solid.
DOM. Aria - Solid.
DOM. AttrValue - Solid.
DOM. HTML - Solid.
DOM. SVG - Solid.
Errors - Solid.
Internal. Action - Solid.
Internal. Equality - Solid.
Internal. Identity - Solid.
Internal. Names - Solid.
Internal. Optimistic - Solid.
Internal. Props - Solid.
Internal. Reply - Solid.
Internal. Serializable - Solid.
Internal. ServerFunction - Solid.
Internal. Setup - Solid.
Internal. Store - Solid.
Internal. Tracked - Solid.
Internal. View - Solid.
JSX - Solid.
Lifecycle - Solid.
Meta - Solid.
Owner - Solid.
Reactivity - Solid.
Root - Solid.
Router - Solid.
Router. Action - Solid.
Router. Path - Solid.
Router. Query - Solid.
Router. Search - Solid.
Setup - Solid.
Signal - Solid.
Start. Middleware - Solid.
Start. RequestEvent - Solid.
Start. Response - Solid.
Start. ServerFunction - Solid.
Start. UseServer - Solid.
Store - Solid.
Testing - Solid.
Utility - Solid.
Web - Solid.
Web. SSR