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

Keys shouldn't be random #11

Open
stevelw opened this issue Nov 7, 2024 · 1 comment
Open

Keys shouldn't be random #11

stevelw opened this issue Nov 7, 2024 · 1 comment
Labels
invalid This doesn't seem right

Comments

@stevelw
Copy link
Owner

stevelw commented Nov 7, 2024

Keys should be consistent between renders, so random numbers should not be used.

Use a reproducible UUID instead. It's suggested to use https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID

key={comment_id ?? Math.random()}

@stevelw stevelw added the invalid This doesn't seem right label Nov 7, 2024
@stevelw
Copy link
Owner Author

stevelw commented Nov 16, 2024

Use Symbol - JavaScript | MDN to generate keys for React elements?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant