Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement identifierPrefix option for useId #22855

Merged
merged 1 commit into from
Dec 3, 2021

Commits on Dec 2, 2021

  1. Implement identifierPrefix option for useId

    When an `identifierPrefix` option is given, React will add it to the
    beginning of ids generated by `useId`.
    
    The main use case is to avoid conflicts when there are multiple React
    roots on a single page.
    
    The server API already supported an `identifierPrefix` option. It's not
    only used by `useId`, but also for React-generated ids that are used to
    stitch together chunks of HTML, among other things. I added a
    corresponding option to the client.
    
    You must pass the same prefix option to both the server and client.
    Eventually we may make this automatic by sending the prefix from the
    server as part of the HTML stream.
    acdlite committed Dec 2, 2021
    Configuration menu
    Copy the full SHA
    4c72cee View commit details
    Browse the repository at this point in the history