useId

useId is a hook for generating unique IDs that are stable across the server and client, while avoiding hydration mismatches.

useId generates a string that includes the : token.

This helps ensure that the token is unique, but is not supported in CSS selectors or APIs like querySelectorAll.

const id = useId();

Unique ID: {id}

Example

Unique ID: :R6:

Unique ID: :R6H1: