2 ms·
It seems from https://github.com/facebook/react/blob/master/packages/simple-cache-provider/src/SimpleCacheProvider.js#L256 https://github.com/facebook/react/blo
by btown 9y ago
It seems from https://github.com/facebook/react/blob/master/packages/simple-cache-provider/src/SimpleCacheProvider.js#L256 https://github.com/facebook/react/blob/master/packages/simpl... that in the live version you'll be specifying which cache to use; this could be global, provided via React's old or new Context APIs, or passed down through props. And you could always write your own fetcher factory if you want to do something really custom; there's nothing special about the SimpleCacheProvider, and it doesn't use any React internals.
- danabramov 9y agoFWIW my demo code looked like export let cache; function initCache() { cache = createCache(initCache); } initCache(); export function createFetcher(fetch) { const res = createResource(fetch); return { read(...args) { return res(cache, ...args); }, }; }
- deleted 9y ago[deleted]