'use client'; import { useEffect, useState } from 'react'; interface Props { code: string; } export default function HtmlPreview({ code }: Props) { const [previewCode, setPreviewCode] = useState(code); // Debounce the preview update to avoid iframe thrashing useEffect(() => { const timer = setTimeout(() => setPreviewCode(code), 500); return () => clearTimeout(timer); }, [code]); return (
Preview