docs: add note that `useId` must be used with single root element

This commit is contained in:
Daniel Roe 2024-03-17 19:17:25 +01:00
parent 5b29dd3f3c
commit 401370b3a0
No known key found for this signature in database
GPG Key ID: CBC814C393D93268
1 changed files with 5 additions and 1 deletions

View File

@ -19,11 +19,15 @@ const id = useId()
<template>
<div>
<label :for="id">Email</label>
<input :id="id" name="email" type="email"/>
<input :id="id" name="email" type="email" />
</div>
</template>
```
::note
`useId` must be used in a component with a single root element, as it uses this root element's attributes to pass the id from server to client.
::
## Parameters
`useId` does not take any parameters.