react-native-svg-asset-plugin
Version:
Asset plugin for importing SVG images in React Native
23 lines (20 loc) • 465 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;
};
}