chore: Refactor ThemePage component to fetch readme asynchronously
This commit is contained in:
@@ -9,7 +9,6 @@ import { ChevronLeft, LoaderCircleIcon } from "lucide-react";
|
|||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
|
|
||||||
export default async function ThemePage() {
|
export default async function ThemePage() {
|
||||||
const [readme, setReadme] = useState<string | null>(null);
|
|
||||||
const params = useParams<{ theme: string }>();
|
const params = useParams<{ theme: string }>();
|
||||||
const { theme: themeID } = params;
|
const { theme: themeID } = params;
|
||||||
|
|
||||||
@@ -18,9 +17,7 @@ export default async function ThemePage() {
|
|||||||
return <div>Theme not found</div>;
|
return <div>Theme not found</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
const readme = await getThemeMarkdown(theme);
|
||||||
getThemeMarkdown(theme).then(setReadme);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mt-24 lg:mt-56 flex-col lg:flex-row flex mx-auto items-start relative">
|
<div className="mt-24 lg:mt-56 flex-col lg:flex-row flex mx-auto items-start relative">
|
||||||
|
|||||||
Reference in New Issue
Block a user