import { useEffect, useState } from "react"; import { codeToHtml } from "../../shiki.bundle"; type Props = { code: string; language: string; }; export default function CodeBlock({ code, language }: Props) { const [highlightedCode, setHighlightedCode] = useState(null); useEffect(() => { let isMounted = true; (async () => { const highlighted = await codeToHtml(code, { lang: language, theme: "github-light", }); if (isMounted) { setHighlightedCode(highlighted); } })(); return () => { isMounted = false; }; }, [code, language]); return (
			{highlightedCode === null ? null : (
				
			)}
		
); }