source: imaps-frontend/node_modules/react-use/esm/useGetSet.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: 507 bytes
Line 
1import { useMemo, useRef } from 'react';
2import useUpdate from './useUpdate';
3import { resolveHookState } from './misc/hookState';
4export default function useGetSet(initialState) {
5 var state = useRef(resolveHookState(initialState));
6 var update = useUpdate();
7 return useMemo(function () { return [
8 function () { return state.current; },
9 function (newState) {
10 state.current = resolveHookState(newState, state.current);
11 update();
12 },
13 ]; }, []);
14}
Note: See TracBrowser for help on using the repository browser.