content icon indicating copy to clipboard operation
content copied to clipboard

Vue tutorial: unique component ID - remove lodash _.uniqueId() for native crypto

Open bnjmnrsh opened this issue 4 months ago • 2 comments

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.

bnjmnrsh avatar Feb 04 '24 01:02 bnjmnrsh

Uploading IMG_1742.png…

danielshedr avatar Feb 04 '24 03:02 danielshedr

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

bsmth avatar May 08 '24 12:05 bsmth