Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 276 Bytes

README.md

File metadata and controls

18 lines (15 loc) · 276 Bytes

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,
  }
);