0.1.0 • Published 4 months ago
swrize v0.1.0
swrize
SWR for functions
import swrize from "swrize";
const myFunc = swrize(
async (foo) => {
const res = await fetch(`https://example.com/${foo}`);
return res.json();
},
{
staleWhileRevalidate: 3600 * 24 * 7,
maxAge: 3600,
}
);