From 4b3dcbd479dbd255b1dedeae328796a3ece42082 Mon Sep 17 00:00:00 2001 From: morning-verlu <258725120+morning-verlu@users.noreply.github.com> Date: Mon, 1 Jun 2026 08:02:36 +0800 Subject: [PATCH] Fix note rendering in RSC docs example --- src/content/reference/rsc/server-components.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/content/reference/rsc/server-components.md b/src/content/reference/rsc/server-components.md index cf33f7d2405..2124c57d4ab 100644 --- a/src/content/reference/rsc/server-components.md +++ b/src/content/reference/rsc/server-components.md @@ -100,7 +100,7 @@ Without Server Components, it's common to fetch dynamic data on the client in an ```js // bundle.js function Note({id}) { - const [note, setNote] = useState(''); + const [note, setNote] = useState(null); // NOTE: loads *after* first render. useEffect(() => { fetch(`/api/notes/${id}`).then(data => { @@ -108,10 +108,14 @@ function Note({id}) { }); }, [id]); + if (note == null) { + return null; + } + return (
{note}
+{note.content}
{note}
+{note.content}