From b107c9af2a89866e0db856cf0371b3af07b50977 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Wed, 15 Feb 2023 15:14:15 +0100 Subject: [PATCH] docs: fix next.js example (#6241) --- dev-docs/docs/@excalidraw/excalidraw/integration.mdx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dev-docs/docs/@excalidraw/excalidraw/integration.mdx b/dev-docs/docs/@excalidraw/excalidraw/integration.mdx index 1fdcb8d8..7080c32e 100644 --- a/dev-docs/docs/@excalidraw/excalidraw/integration.mdx +++ b/dev-docs/docs/@excalidraw/excalidraw/integration.mdx @@ -34,14 +34,16 @@ function App() { Since _Excalidraw_ doesn't support server side rendering, you should render the component once the host is `mounted`. +The following worfklow shows one way how to render Excalidraw on Next.js. We'll add more detailed and alternative Next.js examples, soon. + ```jsx showLineNumbers import { useState, useEffect } from "react"; export default function App() { - const [Comp, setComp] = useState(null); + const [Excalidraw, setExcalidraw] = useState(null); useEffect(() => { - import("@excalidraw/excalidraw").then((comp) => setComp(comp.default)); + import("@excalidraw/excalidraw").then((comp) => setExcalidraw(comp.Excalidraw)); }, []); - return <>{Comp && }; + return <>{Excalidraw && }; } ```