Skip to content

fix: consistent note object type in Server Components docs - #8475

Merged
aurorascharff merged 1 commit into
reactjs:mainfrom
Ashutosh0x:fix/server-components-note-type
Nov 7, 2026
Merged

aurorascharff merged 1 commit into
reactjs:mainfrom
Ashutosh0x:fix/server-components-note-type

Conversation

@Ashutosh0x

Copy link
Copy Markdown
Contributor

Summary

Fixes the Server Components code examples so the note variable is consistently treated as an object throughout all 3 examples on the page.

Closes #6933

Changes

Client Component example (without Server Components):

  • Changed useState('') to useState(null) (note is an object, not a string)
  • Added null guard before accessing note.authorId
  • Changed {note} to {note.content} in JSX

Server Component example (with Server Components):

  • Changed {note} to {note.content} in JSX

Async Server Component example:

  • Changed {note} to <p>{note.content}</p> in JSX

Why

The note object has properties like .authorId, .id, and .content, but was being:

  1. Initialized as an empty string ''
  2. Rendered directly as {note} which would show [object Object]

This is confusing for developers learning React Server Components.

cc @rickhanlonii @poteto

Fixes reactjs#6933

The Server Components docs page had inconsistent handling of the note variable across 3 code examples. All examples now consistently treat note as an object with .authorId, .id, and .content properties.
@github-actions

Copy link
Copy Markdown

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@aurorascharff aurorascharff left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!! ❤️

@aurorascharff
aurorascharff merged commit 058f805 into reactjs:main Nov 7, 2026
2 checks passed

This branch was successfully deployed

1 active deployment
Preview — b257fcaa Deployed Jun 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Typo]: note should be object or string

2 participants