How to use the reason-react/src/ReasonReact.js.Router function in reason-react

To help you get started, we’ve selected a few reason-react examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kMeillet / reason-loadable / src / Core / Shell.bs.js View on Github external
var render = function (param) {
      return param.then((function (html) {
                    ReactDOMRe.renderToElementWithId(html, node);
                    return Promise.resolve(/* () */0);
                  }));
    };
    var partial_arg = App[/* make */0];
    var partial_arg$1 = Utils$ReasonmlCodeSplit.Infix[/* ||> */1];
    var partial_arg$2 = function (param) {
      return partial_arg$1(partial_arg, render, param);
    };
    var partial_arg$3 = Utils$ReasonmlCodeSplit.Fn[/* vtap */1];
    var handler = function (param) {
      return partial_arg$3(partial_arg$2, param);
    };
    var watcher = ReasonReact.Router[/* watchUrl */1](handler);
    ReasonReact.Router[/* push */0](parseUrl(ReasonReact.Router[/* dangerouslyGetInitialUrl */3](/* () */0)));
    return watcher;
  };
  return /* module */[/* bootstrap */bootstrap];
github kMeillet / reason-loadable / src / Core / Router.bs.js View on Github external
newrecord[/* render */9] = (function () {
      return React.createElement("a", {
                  onClick: (function (param) {
                      return redirect(href, param);
                    })
                }, ReasonReact.element(/* None */0, /* None */0, Text$ReasonmlCodeSplit.make(label, /* array */[])));
    });
  return newrecord;
}

var Link = /* module */[
  /* component */component,
  /* make */make
];

var push = ReasonReact.Router[0];

var watchUrl = ReasonReact.Router[1];

var unwatchUrl = ReasonReact.Router[2];

var dangerouslyGetInitialUrl = ReasonReact.Router[3];

export {
  push ,
  watchUrl ,
  unwatchUrl ,
  dangerouslyGetInitialUrl ,
  redirect ,
  initialState ,
  Context ,
  Link ,
github reasonml-old / reason-react-example / src / todomvc / TodoFooter.bs.js View on Github external
function push(path, $$event) {
  $$event.preventDefault();
  return ReasonReact.Router[/* push */0]("#" + path);
}
github kMeillet / reason-loadable / src / Core / Router.bs.js View on Github external
import * as React from "react";
import * as ReasonReact from "reason-react/src/ReasonReact.js";
import * as ReasonReactContext from "reason-react-context/src/reasonReactContext.bs.js";
import * as Text$ReasonmlCodeSplit from "./Text.bs.js";

function redirect(path, $$event) {
  $$event.preventDefault();
  return ReasonReact.Router[/* push */0](path);
}

function initialState() {
  return ReasonReact.Router[/* dangerouslyGetInitialUrl */3](/* () */0);
}

var defaultValue = ReasonReact.Router[/* dangerouslyGetInitialUrl */3](/* () */0);

var Context = ReasonReactContext.CreateContext(/* module */[
      /* name */"Router",
      /* defaultValue */defaultValue
    ]);

var component = ReasonReact.statelessComponent("Link");

function make(href, label, _) {
  var newrecord = component.slice();
  newrecord[/* render */9] = (function () {
      return React.createElement("a", {
                  onClick: (function (param) {
                      return redirect(href, param);
                    })
                }, ReasonReact.element(/* None */0, /* None */0, Text$ReasonmlCodeSplit.make(label, /* array */[])));
github kMeillet / reason-loadable / src / Core / Shell.bs.js View on Github external
return param.then((function (html) {
                    ReactDOMRe.renderToElementWithId(html, node);
                    return Promise.resolve(/* () */0);
                  }));
    };
    var partial_arg = App[/* make */0];
    var partial_arg$1 = Utils$ReasonmlCodeSplit.Infix[/* ||> */1];
    var partial_arg$2 = function (param) {
      return partial_arg$1(partial_arg, render, param);
    };
    var partial_arg$3 = Utils$ReasonmlCodeSplit.Fn[/* vtap */1];
    var handler = function (param) {
      return partial_arg$3(partial_arg$2, param);
    };
    var watcher = ReasonReact.Router[/* watchUrl */1](handler);
    ReasonReact.Router[/* push */0](parseUrl(ReasonReact.Router[/* dangerouslyGetInitialUrl */3](/* () */0)));
    return watcher;
  };
  return /* module */[/* bootstrap */bootstrap];