From a1ddcf51a08cc161182b90a24b409ba11289f73e Mon Sep 17 00:00:00 2001 From: Ricky Date: Fri, 16 Jan 2026 13:27:58 -0500 Subject: [PATCH 1/2] Add caveat to useId for cache keys (#8242) --- src/content/reference/react/useId.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/content/reference/react/useId.md b/src/content/reference/react/useId.md index a77cf7a72..44a11b20d 100644 --- a/src/content/reference/react/useId.md +++ b/src/content/reference/react/useId.md @@ -44,6 +44,8 @@ function PasswordField() { * `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. +* `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. + * `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) * `useId` currently cannot be used in [async Server Components](/reference/rsc/server-components#async-components-with-server-components). From 22ff2c661bda97432d1b989311bdb0441078af4f Mon Sep 17 00:00:00 2001 From: alinkedd Date: Fri, 23 Jan 2026 18:06:45 +0100 Subject: [PATCH 2/2] Resolve merge conflicts --- src/content/reference/react/useId.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/content/reference/react/useId.md b/src/content/reference/react/useId.md index 86e51482b..0a6439c53 100644 --- a/src/content/reference/react/useId.md +++ b/src/content/reference/react/useId.md @@ -44,13 +44,9 @@ function PasswordField() { * `useId` — це хук, тож він може викликатися тільки **на верхньому рівні вашого компонента** або у ваших власних хуках. Ви не можете викликати його в циклах або умовно. Якщо ж є така потреба, то виокреміть новий компонент та перемістіть у нього стан. -<<<<<<< HEAD -* `useId` **не має використовуватися для генерації ключів** у списках. [Ключі мають генеруватися з ваших даних.](/learn/rendering-lists#where-to-get-your-key) -======= -* `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. +* `useId` **не має використовуватися для генерації ключів кешу** для [use()](/reference/react/use). Ідентифікатор стабільний після монтування компонента, але може змінюватися під час рендерингу. Ключі кешу мають генеруватися з ваших даних. -* `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) ->>>>>>> a1ddcf51a08cc161182b90a24b409ba11289f73e +* `useId` **не має використовуватися для генерації ключів** у списках. [Ключі мають генеруватися з ваших даних.](/learn/rendering-lists#where-to-get-your-key) * `useId` наразі не може бути використано в [асинхронних серверних компонентах](/reference/rsc/server-components#async-components-with-server-components).