Skip to content

Instantly share code, notes, and snippets.

@idkjs
Forked from SllyQ/ReactRouter.re
Created November 13, 2017 16:43
Show Gist options
  • Select an option

  • Save idkjs/e9602dee116ffc44da62bfd9dfdb49d7 to your computer and use it in GitHub Desktop.

Select an option

Save idkjs/e9602dee116ffc44da62bfd9dfdb49d7 to your computer and use it in GitHub Desktop.
module Route = {
[@bs.module "react-router-dom"] external reactClass : ReasonReact.reactClass = "Route";
let make = (~component=?, ~render=?, ~exact=?, ~path=?, children) =>
ReasonReact.wrapJsForReason(
~reactClass,
~props={
"path": path |> Js.Nullable.from_opt,
"render": render |> Js.Nullable.from_opt,
"component": component |> Js.Nullable.from_opt,
"exact": exact |> ExtUtils.jsOptBool |> Js.Nullable.from_opt
},
children
);
};
module BrowserRouter = {
[@bs.module "react-router-dom"] external reactClass : ReasonReact.reactClass = "BrowserRouter";
let make = (children) =>
ReasonReact.wrapJsForReason(~reactClass, ~props=Js.Obj.empty(), children);
};
module Link = {
[@bs.module "react-router-dom"] external reactClass : ReasonReact.reactClass = "Link";
let make = (~to_, children) =>
ReasonReact.wrapJsForReason(~reactClass, ~props={"to": to_}, children);
};
module Switch = {
[@bs.module "react-router-dom"] external reactClass : ReasonReact.reactClass = "Switch";
let make = (children) =>
ReasonReact.wrapJsForReason(~reactClass, ~props=Js.Obj.empty(), children);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment