Vue · Senior · Question 23 of 75
Why use useId() (3.5+) for id/aria-* attributes?
- ✓Correct answer: It generates IDs that are unique per app and stable between server and client, avoiding hydration mismatches
- 2It creates database IDs
- 3It encrypts element IDs
Explanation
A random or incrementing module counter produces different values on server and client. useId ties the ID to the component's position in the tree.