Module
React.Router.Types
- Package
- purescript-cofree-react-router
- Repository
- coot/purescript-cofree-react-router
#RouterConfig Source
#IndexRoute Source
data IndexRoute props arg
IndexRoute type The first parameter is the id property.
Constructors
IndexRoute String (RouteClass props arg)
#RouteClass Source
type RouteClass props arg = RoutePropsClass props arg => ReactClass (props arg)
React component which will be mounted at matching node It recieves array of all matching routes.
#RouteProps Source
newtype RouteProps arg
RouteProps
type keeps track route related data: id, currently matched
argument and array of arguments - if the route is nested this will hold
list of all parent arguments.
Constructors
RouteProps { arg :: arg, args :: List arg, id :: String, query :: Map String String, tail :: List (Cofree List { arg :: arg, url :: Route }) }
Instances
RoutePropsClass RouteProps arg
Newtype (RouteProps arg) _
#Router Source
type Router props arg = RoutePropsClass props arg => Cofree List (Tuple (Route props arg) (Maybe (IndexRoute props arg)))
Router
router :: Router RouteProps Unit
router =
Route "main" (unit <$ lit "") mainClass :+
(Route "home" (unit <$ lit "home") homeClass :+ Nil)
: (Tuple (Route "user" (unit <$ (lit "user" *> int)) userClass) (Just $ IndexRoute "user-index" userIndexClass) :<
(Route "book" (unit <$ (lit "books" *> int)) bookClass :+
(Route "pages" (unit <$ lit "pages") pagesClass :+
(Route "page" (unit <$ int) pageClass :+ Nil)
: Nil)
: Nil)
: Nil)
: (Route "user-settings" (unit <$ (lit "user" *> int *> lit "settings")) settingsClass :+ Nil)
: Nil
#withoutIndex Source
withoutIndex :: forall arg props. RoutePropsClass props arg => Route props arg -> List (Cofree List (Tuple (Route props arg) (Maybe (IndexRoute props arg)))) -> Cofree List (Tuple (Route props arg) (Maybe (IndexRoute props arg)))