UNPKG

react-native-mapsforge-vtm

Version:

React Native components to build vector maps using Mapsforges fork of vtm. Offline rendering of OpenStreetMap data. Android only

20 lines (18 loc) 574 B
"use strict"; /** * External dependencies */ import { useRef } from 'react'; /** * Like useState, returns a stateful value, and a function to update it. * But uses a ref instead of a state. * Like this react manages to "update the state" of many sibling components concurrently. Well, it's not updating the state actually, it's updating the ref. */ const useRefState = initial => { const stateRef = useRef(initial); return [stateRef?.current, newVal => { stateRef.current = newVal; }]; }; export default useRefState; //# sourceMappingURL=useRefState.js.map