Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

428 B
Raw Blame
import { textFetcher } from "@dub/utils";
import useSWR, { SWRConfiguration } from "swr";

export default function useGuide(guideKey: string, swrOpts?: SWRConfiguration) {
  const { data: guideMarkdown, error } = useSWR(
    `/api/docs/guides/${guideKey}`,
    textFetcher,
    {
      keepPreviousData: true,
      ...swrOpts,
    },
  );

  return {
    guideMarkdown,
    error,
    loading: !guideMarkdown && !error,
  };
}