about summary refs log tree commit diff
path: root/website/sandbox/nut-score/src/ReducerFromReactJSDocs/ReducerFromReactJSDocs.bs.js
diff options
context:
space:
mode:
Diffstat (limited to 'website/sandbox/nut-score/src/ReducerFromReactJSDocs/ReducerFromReactJSDocs.bs.js')
-rw-r--r--website/sandbox/nut-score/src/ReducerFromReactJSDocs/ReducerFromReactJSDocs.bs.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/website/sandbox/nut-score/src/ReducerFromReactJSDocs/ReducerFromReactJSDocs.bs.js b/website/sandbox/nut-score/src/ReducerFromReactJSDocs/ReducerFromReactJSDocs.bs.js
new file mode 100644
index 000000000000..74322f4a8f45
--- /dev/null
+++ b/website/sandbox/nut-score/src/ReducerFromReactJSDocs/ReducerFromReactJSDocs.bs.js
@@ -0,0 +1,35 @@
+'use strict';
+
+var Curry = require("bs-platform/lib/js/curry.js");
+var React = require("react");
+
+var initialState = /* record */[/* count */0];
+
+function reducer(state, action) {
+  if (action) {
+    return /* record */[/* count */state[/* count */0] - 1 | 0];
+  } else {
+    return /* record */[/* count */state[/* count */0] + 1 | 0];
+  }
+}
+
+function ReducerFromReactJSDocs(Props) {
+  var match = React.useReducer(reducer, initialState);
+  var dispatch = match[1];
+  return React.createElement("div", undefined, React.createElement("div", undefined, "Count: ", String(match[0][/* count */0])), React.createElement("div", undefined, React.createElement("button", {
+                      onClick: (function (_event) {
+                          return Curry._1(dispatch, /* Decrement */1);
+                        })
+                    }, "-"), React.createElement("button", {
+                      onClick: (function (_event) {
+                          return Curry._1(dispatch, /* Increment */0);
+                        })
+                    }, "+")));
+}
+
+var make = ReducerFromReactJSDocs;
+
+exports.initialState = initialState;
+exports.reducer = reducer;
+exports.make = make;
+/* react Not a pure module */