main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
360 bytes
|
Rev | Line | |
---|
[d565449] | 1 | "use strict";
|
---|
| 2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 3 | var react_1 = require("react");
|
---|
| 4 | var toggleReducer = function (state, nextValue) {
|
---|
| 5 | return typeof nextValue === 'boolean' ? nextValue : !state;
|
---|
| 6 | };
|
---|
| 7 | var useToggle = function (initialValue) {
|
---|
| 8 | return react_1.useReducer(toggleReducer, initialValue);
|
---|
| 9 | };
|
---|
| 10 | exports.default = useToggle;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.