Skip to content

Add note about useId being allowed in non-async Server Components #7715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 7, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/content/reference/react/useId.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
title: useId
---

<RSC>

`useId` is allowed in non-async [Server Components](/reference/rsc/server-components).

</RSC>

Copy link
Member

Choose a reason for hiding this comment

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

Can you move this to the caveats? And instead word it as something like "useId currently cannot be used in async server components". And there should be a troubleshooting item for the lint error with an explanation, but that can be added separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! No problem!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved the note to caveats.

Where should I add the troubleshooting item you mentioned? That's on the react hooks eslint package, right?

<Intro>

`useId` is a React Hook for generating unique IDs that can be passed to accessibility attributes.
Expand Down