source: imaps-frontend/node_modules/react-use/lib/useGetSet.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 695 bytes
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var tslib_1 = require("tslib");
4var react_1 = require("react");
5var useUpdate_1 = tslib_1.__importDefault(require("./useUpdate"));
6var hookState_1 = require("./misc/hookState");
7function useGetSet(initialState) {
8 var state = react_1.useRef(hookState_1.resolveHookState(initialState));
9 var update = useUpdate_1.default();
10 return react_1.useMemo(function () { return [
11 function () { return state.current; },
12 function (newState) {
13 state.current = hookState_1.resolveHookState(newState, state.current);
14 update();
15 },
16 ]; }, []);
17}
18exports.default = useGetSet;
Note: See TracBrowser for help on using the repository browser.