All Projects → callstackincubator → Reroute

callstackincubator / Reroute

Licence: mit
a fast, declarative microrouter for reason-react

Programming Languages

ocaml
1615 projects

Projects that are alternatives of or similar to Reroute

Verified React
Automated reasoning for React/ReasonML
Stars: ✭ 104 (-13.33%)
Mutual labels:  reason-react, reasonml
Rescript React Native
ReScript bindings for React Native
Stars: ✭ 802 (+568.33%)
Mutual labels:  reason-react, reasonml
Reductive
Redux in Reason
Stars: ✭ 405 (+237.5%)
Mutual labels:  reason-react, reasonml
bs-react-native-vector-icons
ReasonML bindings for react-native-vector-icons
Stars: ✭ 16 (-86.67%)
Mutual labels:  reasonml, reason-react
Reason Calculator
A calculator built with Reason and reason-react.
Stars: ✭ 110 (-8.33%)
Mutual labels:  reason-react, reasonml
React Recomponent
🥫 Reason-style reducer components for React using ES6 classes.
Stars: ✭ 272 (+126.67%)
Mutual labels:  reason-react, reasonml
Timerlab
⏰ A simple and customizable timer
Stars: ✭ 84 (-30%)
Mutual labels:  reason-react, reasonml
react-multiversal
React components that works everywhere (iOS, Android, Web, Node)
Stars: ✭ 43 (-64.17%)
Mutual labels:  reasonml, reason-react
Recontainers
[DEPRECATED] ReasonReact utilitary high order components
Stars: ✭ 54 (-55%)
Mutual labels:  reason-react, reasonml
Pragma
Pragma is a self-hosted, open-source, personal note taking app.
Stars: ✭ 39 (-67.5%)
Mutual labels:  reason-react, reasonml
rescript-react-compat
An alternative upgrade path for ReasonReact
Stars: ✭ 17 (-85.83%)
Mutual labels:  reasonml, reason-react
Introduce Reason Example
An example app made with Create React App which introduces a Reason component
Stars: ✭ 82 (-31.67%)
Mutual labels:  reason-react, reasonml
credt
CRDT-like data structures for building distributed, offline-first applications
Stars: ✭ 32 (-73.33%)
Mutual labels:  reasonml, reason-react
Isolate
Lightweight image browser
Stars: ✭ 284 (+136.67%)
Mutual labels:  reason-react, reasonml
bs-react-is-visible
A small library that lets you know whether a component is visible on screen or not.
Stars: ✭ 15 (-87.5%)
Mutual labels:  reasonml, reason-react
Reason React Hacker News
hacker news mobile app made with reason react
Stars: ✭ 591 (+392.5%)
Mutual labels:  reason-react, reasonml
reason-rt-binding-generator
Reason binding generator for react-toolbox
Stars: ✭ 18 (-85%)
Mutual labels:  reasonml, reason-react
onetricks.net
(WIP) kayn-powered (typescript node.js) ReasonReact app presenting you a dashboard of high ELO one trick ponies in League of Legends
Stars: ✭ 13 (-89.17%)
Mutual labels:  reasonml, reason-react
Cra Template Rescript Lukin
🐪 Lukin CRA and ReScript Template
Stars: ✭ 18 (-85%)
Mutual labels:  reason-react, reasonml
Rescript React Update
useReducer with updates and side effects!
Stars: ✭ 79 (-34.17%)
Mutual labels:  reason-react, reasonml

reroute

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 your bsconfig.json dependencies

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

Usage

module RouterConfig = {
  type route =
    | Admin
    | Home;
  let routeFromUrl = (url: ReasonReact.Router.url) =>
    switch url.path {
    | ["admin"] => Admin
    | [] => Home
    };
  let routeToUrl = (route: route) =>
    switch route {
    | Admin => "/admin"
    | Home => "/"
    };
};

module Router = ReRoute.CreateRouter(RouterConfig);

let component = ReasonReact.statelessComponent("App");

let make = _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 of reroute has been highly influenced by @thangngoc89 and his reference implementation. Thank you for pushing this forward!

License

MIT (c) 2018 Callstack

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].