Skip to content

Instantly share code, notes, and snippets.

@28development
Created February 28, 2022 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 28development/550c317cd33a3f57a0c748530b2345c2 to your computer and use it in GitHub Desktop.
Save 28development/550c317cd33a3f57a0c748530b2345c2 to your computer and use it in GitHub Desktop.
import fetcher from "@/utils/fetcher";
import useSWR from "swr";
const useFetchAllSnippets = () => {
const { data, error } = useSWR("/api/snippet", fetcher);
return {
snippets: data,
isLoading: !error && !data,
isError: error
}
}
export default useFetchAllSnippets;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment