Module
React.Router.Components
- Package
- purescript-cofree-react-router
- Repository
- coot/purescript-cofree-react-router
#BrowserRouter Source
newtype BrowserRouter props arg notFoundProps
BrowserRouter prop type
Constructors
BrowserRouter { config :: RouterConfig, notFound :: Maybe { cls :: ReactClass notFoundProps, props :: notFoundProps }, router :: Cofree List (Tuple (Route props arg) (Maybe (IndexRoute props arg))) }
#browserRouter Source
browserRouter :: forall notfound arg props eff. RoutePropsClass props arg => ReactSpec (BrowserRouter props arg notfound) Location (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 => ReactClass (BrowserRouter 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_)
```
#linkClass Source
linkClass :: forall eff. ReactClass (LinkProps eff)
React class for the link
element.
#link Source
link :: RouterConfig -> URL -> Array Props -> Array ReactElement -> ReactElement
link
element; use it instead of a
to route the user through
application with the default action goto cfg url
and custom properties.
#link' Source
link' :: RouterConfig -> URL -> Array ReactElement -> ReactElement
as link
, but with empty props.