Skip to content

Commit aa01f6b

Browse files
authored
Merge pull request #146 from reactjs/sync-a1ddcf51
Sync with react.dev @ a1ddcf5
2 parents e104ed0 + dfbd2ce commit aa01f6b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/content/reference/react/useId.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ function PasswordField() {
4444
4545
* `useId` is a Hook, so you can only call it **at the top level of your component** or your own Hooks. You can't call it inside loops or conditions. If you need that, extract a new component and move the state into it.
4646
47+
* `useId` **should not be used to generate cache keys** for [use()](/reference/react/use). The ID is stable when a component is mounted but may change during rendering. Cache keys should be generated from your data.
48+
4749
* `useId` **should not be used to generate keys** in a list. [Keys should be generated from your data.](/learn/rendering-lists#where-to-get-your-key)
4850
4951
* `useId` currently cannot be used in [async Server Components](/reference/rsc/server-components#async-components-with-server-components).

0 commit comments

Comments
 (0)