---
source: https://iinventedlight.com/library/notes/react-useid.md
title: "React useId: unique IDs for accessibility attributes"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (React docs); CC-BY-4.0 (reactjs/react.dev); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: React docs, useId; reactjs/react.dev, useId.md. CC-BY-4.0 (https://raw.githubusercontent.com/reactjs/react.dev/main/LICENSE-DOCS.md). Copyright Meta Platforms, Inc. and affiliates."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: react useId"
tags: [react, useId, accessibility, hooks]
client: Librarian
sources:
  - id: S1
    title: "useId"
    publisher: React docs
    url: https://react.dev/reference/react/useId
    accessed: 2026-11-18
    license: "CC-BY-4.0"
  - id: S2
    title: "useId.md"
    publisher: reactjs/react.dev
    url: https://github.com/reactjs/react.dev/blob/main/src/content/reference/react/useId.md
    accessed: 2026-11-18
    license: "CC-BY-4.0"
---
# React useId: unique IDs for accessibility attributes
**Answer:** useId is a Hook that generates unique IDs you can pass to accessibility attributes. useId does not take any parameters. You cannot call it inside loops or conditions. useId should not be used to generate cache keys.

## Examples

```js
import { useId } from 'react';

function Field() {
  const id = useId();
  return <><label htmlFor={id}>Name</label><input id={id} /></>;
}
```

## Notes

Call useId at the top level of your component. If you need IDs in a loop, extract a new component and move the hook into it. The ID is stable when a component is mounted, but it may change during rendering. Generate cache keys from your data instead.

## Reference list

- `useId` generates unique IDs for accessibility attributes.
- `useId` does not take any parameters.
- `not` Do not use useId to generate cache keys.

## See also

- [react-effects](https://iinventedlight.com/library/notes/react-effects/)
- [react-state](https://iinventedlight.com/library/notes/react-state/)
- [react-components-basics](https://iinventedlight.com/library/notes/react-components-basics/)

## Claims

- id: C1
  claim: useId generates unique IDs for accessibility attributes.
  source: S1
  evidence: "useId is a React Hook for generating unique IDs"

- id: C2
  claim: useId does not take any parameters.
  source: S2
  evidence: "`useId` does not take any parameters"

- id: C3
  claim: Do not use useId to generate cache keys.
  source: S2
  evidence: "useId` **should not be used to generate cache keys**"

## Sources

- [S1] useId. React docs. https://react.dev/reference/react/useId . License: CC-BY-4.0. Accessed 2026-11-18.

- [S2] useId.md. reactjs/react.dev. https://github.com/reactjs/react.dev/blob/main/src/content/reference/react/useId.md . License: CC-BY-4.0. Accessed 2026-11-18.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: React docs, useId; reactjs/react.dev, useId.md. CC-BY-4.0 (https://raw.githubusercontent.com/reactjs/react.dev/main/LICENSE-DOCS.md). Copyright Meta Platforms, Inc. and affiliates. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
