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

Add : to beginning and end of every useId #23360

Merged
merged 1 commit into from
Feb 25, 2022
Merged

Commits on Feb 25, 2022

  1. Add : to beginning and end of every useId

    The ids generated by useId are unique per React root. You can create
    additional ids by concatenating them with locally unique strings.
    
    To support this pattern, no id will ever be a subset of another id. We
    achieve this by adding a special character to the beginning and end.
    
    We use a colon (":") because it's uncommon — even if you don't prefix
    the ids using the `identifierPrefix` option, collisions are unlikely.
    
    One downside of a colon is that it's not a valid character in DOM
    selectors, like `querySelectorAll`. We think this is probably
    fine because it's not a common use case in React, and there are
    workarounds or alternative solutions. But we're open to reconsidering
    this in the future if there's a compelling argument.
    acdlite committed Feb 25, 2022
    Configuration menu
    Copy the full SHA
    030815d View commit details
    Browse the repository at this point in the history