source: imaps-frontend/node_modules/react-use/lib/useSetState.js

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: 566 bytes
RevLine 
[d565449]1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var react_1 = require("react");
4var useSetState = function (initialState) {
5 if (initialState === void 0) { initialState = {}; }
6 var _a = react_1.useState(initialState), state = _a[0], set = _a[1];
7 var setState = react_1.useCallback(function (patch) {
8 set(function (prevState) {
9 return Object.assign({}, prevState, patch instanceof Function ? patch(prevState) : patch);
10 });
11 }, []);
12 return [state, setState];
13};
14exports.default = useSetState;
Note: See TracBrowser for help on using the repository browser.