Module
React.Router.Components
- Package
- purescript-cofree-react-router
- Repository
- coot/purescript-cofree-react-router
#browserRouter Source
browserRouter :: forall notfound arg props eff. RoutePropsClass props arg => RouterConfig -> ReactSpec (RouterProps props arg notfound) RouterState (console :: CONSOLE, dom :: DOM, history :: HISTORY | eff)ReactSpec for the browserRouterClass - the main entry point react
class for the router.
#browserRouterClass Source
browserRouterClass :: forall notfound arg props. RoutePropsClass props arg => RouterConfig -> ReactClass (RouterProps props arg notfound)React class for the browerRouter element. Use it to init your application.
router = ... :: Router _
main = void $ elm >>= render (createElement browserRouterClass {router, notFound: Nothing} [])
where
elm = do
elm_ <- window >>= document >>= getElementById (ElementId "app") <<< documentToNonElementParentNode <<< htmlDocumentToDocument
pure $ unsafePartial fromJust (toMaybe elm_)
```
#linkSpec Source
linkSpec :: RouterConfig -> ReactSpec LinkProps Unit ()ReactSpec for the link element; it takes a record of type LinkProps
as properties. The props record property is directly passed to underlying
a element, e.g. this can be used to add css classes.
#link Source
link :: RouterConfig -> LinkProps -> Array ReactElement -> ReactElementlink element; use it instead of a to route the user through application.
#link' Source
link' :: RouterConfig -> String -> Array ReactElement -> ReactElementas link, but with empty properties passed to the underlying a element.