Module

React.Router.Components

Package
purescript-cofree-react-router
Repository
coot/purescript-cofree-react-router

#browserRouter Source

browserRouter :: forall eff props arg notfound. RoutePropsClass props arg => RouterConfig -> ReactSpec (RouterProps props arg notfound) RouterState (history :: HISTORY, dom :: DOM, console :: CONSOLE | eff)

ReactSpec for the browserRouterClass - the main entry point react class for the router.

#browserRouterClass Source

browserRouterClass :: forall props arg notfound. 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 -> String -> Array ReactElement -> ReactElement

as link, but with empty properties passed to the underlying a element.

#goTo Source

goTo :: forall eff. RouterConfig -> String -> Eff (console :: CONSOLE, dom :: DOM, history :: HISTORY | eff) Unit