Skip to content

1.0.51 - The schema memo update

Compare
Choose a tag to compare
@hazae41 hazae41 released this 30 Aug 16:25
· 834 commits to master since this release

BREAKING CHANGES

  • New syntax for XSWR.use: XSWR.use(schema) => XSWR.use(factory, deps)
function getCatShema(id: string) {
  return XSWR.single(["/api/cat", id], fetchAsJson)
}

function useCatBase(id: string) {
 return XSWR.use(getCatSchema, [id])
}

It works like useMemo but the deps are passed to the factory.