react-native-svg-asset-plugin
Version:
Asset plugin for importing SVG images in React Native
19 lines (18 loc) • 485 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.memo = memo;
/**
* Returns a memoized version of the async callback function which
* will always return the same value on subsequent calls.
*
* This is useful to provide lazy, but cached, loading of data.
*/
function memo(callback) {
let memoizedValue;
return () => {
if (!memoizedValue) {
memoizedValue = callback();
}
return memoizedValue;
};
}