content
content copied to clipboard
Vue tutorial: unique component ID - remove lodash _.uniqueId() for native crypto
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.
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