react-native-mapsforge-vtm
Version:
React Native components to build vector maps using Mapsforges fork of vtm. Offline rendering of OpenStreetMap data. Android only
24 lines (22 loc) • 694 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = require("react");
/**
* External dependencies
*/
/**
* 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 = (0, _react.useRef)(initial);
return [stateRef?.current, newVal => {
stateRef.current = newVal;
}];
};
var _default = exports.default = useRefState;
//# sourceMappingURL=useRefState.js.map