mdn / content

The content behind MDN Web Docs
https://developer.mozilla.org
Other
9k stars 22.44k forks source link

[Vue] unique component ID - remove nanoid for native crypto #32101

Open bnjmnrsh opened 5 months ago

bnjmnrsh commented 5 months ago

MDN URL

https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_first_component

What specific section or headline is this issue about?

https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_first_component#giving_todos_a_unique_id

What information was incorrect, unhelpful, or incomplete?

Lodash isn’t needed now that crypto.randomUUID() is widely supported.

What did you expect to see?

An opportunity to drop a dependancy as the browser has our backs!

Do you have any supporting links, references, or citations?

https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID

Do you have anything more you want to share?

Using Lodash is perhaps a useful example of importing parts of another library into a project, however where possible I believe it’s better to provide examples which rely on the platform.

danielshedr commented 5 months ago

![Uploading IMG_1742.png…]()

bsmth commented 2 months ago

Thanks for raising. There's been some recent changes to this section which use nanoid instead of lodash, but your suggestion still stands.

https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_first_component#giving_todos_a_unique_id

It looks like cross-browser support landed 2+ years ago for randomUUID(). Do you want to open a PR in the example repo first so we can see how the project looks before updating the docs?

Repo: https://github.com/mdn/todo-vue