IK
Interview Knowledge Book
Topics
Practice
Examples
Playground
RU
browser
Fetch key deduplication
Show how a stable key lets server and client reuse the same cached payload.
index.js
const cache = new Map(); function useFetch(key, loader) { if (!cache.has(key)) cache.set(key, loader()); return cache.get(key); } useFetch('posts', () => console.log('server fetch posts')); useFetch('posts', () => console.log('client reuse posts'));
Run
Stop
Reset