How to use the reason-react/src/ReasonReact.js.reducerComponent 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 OneGraph / onegraph-examples / spotify-app / src / App.bs.js View on Github external
32
            ]),
        /* :: */[
          Emotion.marginBottom(/* `px */[
                25096,
                64
              ]),
          /* :: */[
            Emotion.fontWeight(200),
            /* [] */0
          ]
        ]
      ]
    ]);

var component = ReasonReact.reducerComponent("App");

function make(_children) {
  return /* record */[
          /* debugName */component[/* debugName */0],
          /* reactClassInternal */component[/* reactClassInternal */1],
          /* handedOffState */component[/* handedOffState */2],
          /* willReceiveProps */component[/* willReceiveProps */3],
          /* didMount */(function (self) {
              self[/* state */1][/* auth */1].isLoggedIn("spotify").then((function (loginStatus) {
                        console.log(loginStatus);
                        Curry._1(self[/* send */3], /* SetLogInStatus */[loginStatus]);
                        return Promise.resolve(/* () */0);
                      })).catch((function (err) {
                      return Promise.resolve((console.log(err), /* () */0));
                    }));
              return /* () */0;
github rebench / rebench.github.io / src / common / components / Editor.bs.js View on Github external
return "rust";
    } else {
      return "javascript";
    }
  } else {
    return "mllike";
  }
}

function setMarks(editor, marks) {
  return Rebase.Option[/* forEach */8]((function (editor) {
                return CodeMirror.setMarks(editor, Rebase.$$Array[/* fromList */13](marks));
              }), editor[0]);
}

var component = ReasonReact.reducerComponent("Editor");

function make(value, lang, defaultValue, $staropt$star, $staropt$star$1, inputRef, onChange, _) {
  var marks = $staropt$star ? $staropt$star[0] : /* [] */0;
  var readOnly = $staropt$star$1 ? $staropt$star$1[0] : false;
  return /* record */[
          /* debugName */component[/* debugName */0],
          /* reactClassInternal */component[/* reactClassInternal */1],
          /* handedOffState */component[/* handedOffState */2],
          /* willReceiveProps */component[/* willReceiveProps */3],
          /* didMount */component[/* didMount */4],
          /* didUpdate */(function (param) {
              return setMarks(param[/* newSelf */1][/* state */1][/* editor */0], marks);
            }),
          /* willUnmount */component[/* willUnmount */6],
          /* willUpdate */component[/* willUpdate */7],
          /* shouldUpdate */component[/* shouldUpdate */8],
github emjun / tea-lang / reason / src / Component2.bs.js View on Github external
// Generated by BUCKLESCRIPT VERSION 4.0.8, PLEASE EDIT WITH CARE
'use strict';

var Block = require("bs-platform/lib/js/block.js");
var Curry = require("bs-platform/lib/js/curry.js");
var React = require("react");
var ReasonReact = require("reason-react/src/ReasonReact.js");

var component = ReasonReact.reducerComponent("Example");

function make(greeting, _children) {
  return /* record */[
          /* debugName */component[/* debugName */0],
          /* reactClassInternal */component[/* reactClassInternal */1],
          /* handedOffState */component[/* handedOffState */2],
          /* willReceiveProps */component[/* willReceiveProps */3],
          /* didMount */component[/* didMount */4],
          /* didUpdate */component[/* didUpdate */5],
          /* willUnmount */component[/* willUnmount */6],
          /* willUpdate */component[/* willUpdate */7],
          /* shouldUpdate */component[/* shouldUpdate */8],
          /* render */(function (self) {
              var message = "You've clicked this " + (String(self[/* state */1][/* count */0]) + " times(s)");
              var match = self[/* state */1][/* show */1];
              return React.createElement("div", undefined, React.createElement("button", {
github Simon-Initiative / authoring-client / src / editors / content / learning / table / TableCreation.bs.js View on Github external
// Generated by BUCKLESCRIPT VERSION 4.0.18, PLEASE EDIT WITH CARE
'use strict';

var $$Array = require("bs-platform/lib/js/array.js");
var Block = require("bs-platform/lib/js/block.js");
var Curry = require("bs-platform/lib/js/curry.js");
var React = require("react");
var Caml_int32 = require("bs-platform/lib/js/caml_int32.js");
var ReasonReact = require("reason-react/src/ReasonReact.js");
var Caml_primitive = require("bs-platform/lib/js/caml_primitive.js");
var ListUtils$CourseEditor = require("../../../../utils/reason/ListUtils.bs.js");

var component = ReasonReact.reducerComponent("TableCreation");

function str(prim) {
  return prim;
}

function rowStyle(param) {
  return {
          whiteSpace: "nowrap"
        };
}

function cellContainerStyle(param) {
  return {
          cursor: "pointer",
          display: "inline-block",
          padding: "2px"
github OneGraph / onegraph-examples / spotify-app / src / CurrentlyPlaying.bs.js View on Github external
]
      ]
    ]);

var albumImage = Emotion.css(undefined, /* :: */[
      Emotion.label("albumImage"),
      /* :: */[
        Emotion.width(/* `pct */[
              5591841,
              100
            ]),
        /* [] */0
      ]
    ]);

var component = ReasonReact.reducerComponent("User");

function make(songName, artistName, isPlaying, progressPct, imageUrl, _children) {
  return /* record */[
          /* debugName */component[/* debugName */0],
          /* reactClassInternal */component[/* reactClassInternal */1],
          /* handedOffState */component[/* handedOffState */2],
          /* willReceiveProps */component[/* willReceiveProps */3],
          /* didMount */component[/* didMount */4],
          /* didUpdate */component[/* didUpdate */5],
          /* willUnmount */component[/* willUnmount */6],
          /* willUpdate */component[/* willUpdate */7],
          /* shouldUpdate */component[/* shouldUpdate */8],
          /* render */(function (self) {
              return React.createElement("div", {
                          className: "current-playing"
                        }, React.createElement("div", {
github phated / mxdbmobile / src / GridOfCards.js View on Github external
}

var MT_Ret = /* module */[];

var CardQuery = /* module */[
  /* Graphql_error */Graphql_error,
  /* ppx_printed_query */ppx_printed_query,
  /* query */ppx_printed_query,
  /* parse */parse,
  /* make */make,
  /* makeWithVariables */makeWithVariables,
  /* ret_type */ret_type,
  /* MT_Ret */MT_Ret
];

var component = ReasonReact.reducerComponent("GridOfCards");

var container = Style$BsReactNative.style(/* :: */[
      Style$BsReactNative.flex(1),
      /* :: */[
        Style$BsReactNative.alignItems(/* Stretch */3),
        /* [] */0
      ]
    ]);

var small = Style$BsReactNative.style(/* :: */[
      Style$BsReactNative.height(/* Pt */Block.__(0, [100])),
      /* :: */[
        Style$BsReactNative.width(/* Pt */Block.__(0, [72])),
        /* [] */0
      ]
    ]);
github rebench / rebench.github.io / src / common / services / OnClickOutside.bs.js View on Github external
'use strict';

var Curry = require("bs-platform/lib/js/curry.js");
var Rebase = require("@glennsl/rebase/src/Rebase.bs.js");
var ReasonReact = require("reason-react/src/ReasonReact.js");

var component = ReasonReact.reducerComponent("OnClickOutside");

function make(onClick, children) {
  return /* record */[
          /* debugName */component[/* debugName */0],
          /* reactClassInternal */component[/* reactClassInternal */1],
          /* handedOffState */component[/* handedOffState */2],
          /* willReceiveProps */component[/* willReceiveProps */3],
          /* didMount */component[/* didMount */4],
          /* didUpdate */component[/* didUpdate */5],
          /* willUnmount */component[/* willUnmount */6],
          /* willUpdate */component[/* willUpdate */7],
          /* shouldUpdate */component[/* shouldUpdate */8],
          /* render */(function (param) {
              return ReasonReact.createDomElement("div", {
                          ref: Curry._1(param[/* handle */0], (function (r, param) {
                                  param[/* state */1][/* rootRef */0][0] = (r == null) ? /* None */0 : [r];
github reasonml-old / reason-react-example / src / fetch / FetchExample.bs.js View on Github external
var Belt_Array = require("bs-platform/lib/js/belt_Array.js");
var Json_decode = require("@glennsl/bs-json/src/Json_decode.bs.js");
var ReasonReact = require("reason-react/src/ReasonReact.js");

function dogs(json) {
  var __x = Json_decode.field("message", (function (param) {
          return Json_decode.array(Json_decode.string, param);
        }), json);
  return Belt_Array.map(__x, (function (dog) {
                return dog;
              }));
}

var Decode = /* module */[/* dogs */dogs];

var component = ReasonReact.reducerComponent("FetchExample");

function make() {
  return /* record */[
          /* debugName */component[/* debugName */0],
          /* reactClassInternal */component[/* reactClassInternal */1],
          /* handedOffState */component[/* handedOffState */2],
          /* willReceiveProps */component[/* willReceiveProps */3],
          /* didMount */(function (self) {
              return Curry._1(self[/* send */3], /* DogsFetch */0);
            }),
          /* didUpdate */component[/* didUpdate */5],
          /* willUnmount */component[/* willUnmount */6],
          /* willUpdate */component[/* willUpdate */7],
          /* shouldUpdate */component[/* shouldUpdate */8],
          /* render */(function (self) {
              var match = self[/* state */1];
github OneGraph / onegraph-examples / spotify-app / src / User.bs.js View on Github external
0
            ], /* `px */[
              25096,
              24
            ]),
        /* :: */[
          Emotion.marginRight(/* `px */[
                25096,
                48
              ]),
          /* [] */0
        ]
      ]
    ]);

var component = ReasonReact.reducerComponent("User");

function make(auth, setLogInStatus, userName, _children) {
  return /* record */[
          /* debugName */component[/* debugName */0],
          /* reactClassInternal */component[/* reactClassInternal */1],
          /* handedOffState */component[/* handedOffState */2],
          /* willReceiveProps */component[/* willReceiveProps */3],
          /* didMount */component[/* didMount */4],
          /* didUpdate */component[/* didUpdate */5],
          /* willUnmount */component[/* willUnmount */6],
          /* willUpdate */component[/* willUpdate */7],
          /* shouldUpdate */component[/* shouldUpdate */8],
          /* render */(function (self) {
              return React.createElement("header", {
                          className: AppStyle$ReactTemplate.flexWrapper(/* flexEnd */924268066, /* center */98248149)
                        }, React.createElement("div", {
github rebench / rebench.github.io / src / common / components / ShareButton.bs.js View on Github external
'use strict';

var Block = require("bs-platform/lib/js/block.js");
var Curry = require("bs-platform/lib/js/curry.js");
var React = require("react");
var Button = require("./Button.bs.js");
var Rebase = require("@glennsl/rebase/src/Rebase.bs.js");
var Vrroom = require("vrroom/src/Vrroom.bs.js");
var ReasonReact = require("reason-react/src/ReasonReact.js");
var TypedGlamor = require("bs-typed-glamor/src/TypedGlamor.bs.js");
var ShareButtonStyles = require("./ShareButtonStyles.bs.js");

var component = ReasonReact.reducerComponent("ShareButton");

function make(url, _) {
  return /* record */[
          /* debugName */component[/* debugName */0],
          /* reactClassInternal */component[/* reactClassInternal */1],
          /* handedOffState */component[/* handedOffState */2],
          /* willReceiveProps */component[/* willReceiveProps */3],
          /* didMount */component[/* didMount */4],
          /* didUpdate */component[/* didUpdate */5],
          /* willUnmount */component[/* willUnmount */6],
          /* willUpdate */component[/* willUpdate */7],
          /* shouldUpdate */component[/* shouldUpdate */8],
          /* render */(function (param) {
              var send = param[/* send */3];
              return React.createElement("div", {
                          className: TypedGlamor.toString(ShareButtonStyles.container(param[/* state */1][/* showConfirmation */0]))