swr icon indicating copy to clipboard operation
swr copied to clipboard

Clear Cache Hook

Open daveycodez opened this issue 4 months ago • 0 comments

/** Hook for clearing cache */
export const useClearCache = () => {
    const { mutate } = useSWRConfig()

    const clearCache = () => {
        mutate(() => true, undefined, false)
    }

    return clearCache
}

Plz export this hook directly from SWR so we can keep our codebases cleaner

daveycodez avatar Oct 02 '24 20:10 daveycodez