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:
695 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | var tslib_1 = require("tslib");
|
---|
4 | var react_1 = require("react");
|
---|
5 | var useUpdate_1 = tslib_1.__importDefault(require("./useUpdate"));
|
---|
6 | var hookState_1 = require("./misc/hookState");
|
---|
7 | function 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 | }
|
---|
18 | exports.default = useGetSet;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.