Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

a fast, declarative microrouter for reason-react

License

NotificationsYou must be signed in to change notification settings

callstackincubator/reroute

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

a fast, declarative microrouter for reason-react

Getting started

Installation

Open a Terminal in your project's folder and run,

$ yarn add reason-reroute

After installation, you will need to add this library to yourbsconfig.json dependencies

"bs-dependencies": [  "reason-react",  "reason-reroute"],

Usage

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>};

API

Sections below are under construction.

Link

Container

Rationale

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.

Credits

The concept ofreroute has been highly influenced by@thangngoc89 and hisreference implementation. Thank you for pushing this forward!

License

MIT (c) 2018 Callstack

About

a fast, declarative microrouter for reason-react

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors5

Languages


[8]ページ先頭

©2009-2025 Movatter.jp