Module
React.Router.Types
- Package
- purescript-cofree-react-router
- Repository
- coot/purescript-cofree-react-router
#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
Instances
#RouteClass Source
type RouteClass props arg = RoutePropsClass props => ReactClass (props arg)
React component which will be mounted at matching node It recieves array of all matching routes.
#IndexRoute Source
data IndexRoute props arg
IndexRoute type The first parameter is the id property.
Constructors
IndexRoute String (RouteClass props arg)
#urlLens Source
urlLens :: forall arg props. RoutePropsClass props => Lens' (Route props arg) (Match arg)
#Router Source
type Router props arg = RoutePropsClass props => Cofree Array (Tuple (Route props arg) (Maybe (IndexRoute props arg)))
Router
router =
Route "home" "/" Home :+
[ Route "user" "user/:id" User :+
[ Route "email" "email" UserEmail :+ []
, Route "password" "password" UserPassword :+ []
]
, Tuple (Route "books" "books" Books) (Just BooksIndex) :<
[ Route "book" ":id" Book :+ []
, Route "reader" "reader" BookReader :+ []
]
]
#withoutIndex Source
withoutIndex :: forall arg props. RoutePropsClass props => Route props arg -> Array (Cofree Array (Tuple (Route props arg) (Maybe (IndexRoute props arg)))) -> Cofree Array (Tuple (Route props arg) (Maybe (IndexRoute props arg)))