- Notifications
You must be signed in to change notification settings - Fork8
a fast, declarative microrouter for reason-react
License
callstackincubator/reroute
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
a fast, declarative microrouter for reason-react
Open a Terminal in your project's folder and run,
$ yarn add reason-rerouteAfter installation, you will need to add this library to yourbsconfig.json dependencies
"bs-dependencies": [ "reason-react", "reason-reroute"],moduleRouterConfig= {typeroute=|Admin|Home;letrouteFromUrl= (url:ReasonReact.Router.url)=>switch url.path {|["admin"]=>Admin|[]=>Home };letrouteToUrl= (route:route)=>switch route {|Admin=>"/admin"|Home=>"/" };};moduleRouter=ReRoute.CreateRouter(RouterConfig);letcomponent=ReasonReact.statelessComponent("App");letmake= _children=> {...component, render: _self=> <Router.Container> ...( (~currentRoute)=>switch currentRoute {|RouterConfig.Admin=> <Admin />|RouterConfig.Home=> <Home /> } ) </Router.Container>};
Sections below are under construction.
ReasonReact comes with a router (ReasonReact.Router) by default. It offers minimal yet powerful API that is suitable for applications at any scale. However, being just an API, it leaves the routing logic up to the developer. This library builds on top of it to provide an elegant interface for working with routes that is ready to use, predictable and consistent across apps you create.
The concept ofreroute has been highly influenced by@thangngoc89 and hisreference implementation. Thank you for pushing this forward!
MIT (c) 2018 Callstack
About
a fast, declarative microrouter for reason-react
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.