curriculum icon indicating copy to clipboard operation
curriculum copied to clipboard

Update keys_in_react.md

Open asimn7 opened this issue 1 year ago • 10 comments

feat: Added v4 to uuidv4 as uuid is not supported in the latest versions of Javascript.

Because when I tried doing uuid, I started getting errors, then after I researched the issue for a bit, I found it was a bit outdated code, the newer ones support 'uuidv4'.

This PR

  • changed from 'uuid' to 'uuidv4' and added import

Issue

Closes #XXXXX

Additional Information

Pull Request Requirements

  • [x] I have thoroughly read and understand The Odin Project curriculum contributing guide
  • [x] The title of this PR follows the location of change: brief description of change format, e.g. Intro to HTML and CSS lesson: Fix link text
  • [x] The Because section summarizes the reason for this PR
  • [x] The This PR section has a bullet point list describing the changes in this PR
  • [x] If this PR addresses an open issue, it is linked in the Issue section
  • [x] If any lesson files are included in this PR, they have been previewed with the Markdown preview tool to ensure it is formatted correctly
  • [x] If any lesson files are included in this PR, they follow the Layout Style Guide

asimn7 avatar Jun 12 '24 18:06 asimn7

Sorry, if this is a minor change, I got stuck here for quite a bit, so I thought of adding it.

asimn7 avatar Jun 12 '24 18:06 asimn7

I don;t really know how the pull thing works, I think I have to reopen though.

asimn7 avatar Jun 12 '24 18:06 asimn7

I don;t really know how the pull thing works, I think I have to reopen though.

Yes; you've opened a pull request, and now need to wait for one of the maintainers to review it. If they approve it, they will merge it into the main branch, at which point your changes will be applied to the live version of the curriculum

Asartea avatar Jun 12 '24 18:06 Asartea

We could do something clever and reduce it to just:

import { v4 as uuid } from 'uuid';

It will update the code to use the v4 uuids, but keep the rest of the function calls as they currently are.

xandora avatar Jun 13 '24 09:06 xandora

Actually, if all we're doing is creating UUID's, do we even need the library? I'm fairly the build in crypto library has a function for that

Asartea avatar Jun 13 '24 17:06 Asartea

Actually, if all we're doing is creating UUID's, do we even need the library? I'm fairly the build in crypto library has a function for that

You read that too? :D I agree though, we could do it that way. Might need some of the other maintainers to check there's no actual reason why we're using uuid specifically first.

xandora avatar Jun 13 '24 20:06 xandora

You read that too? :D

I plead the Fifth

I agree though, we could do it that way. Might need some of the other maintainers to check there's no actual reason why we're using uuid specifically first.

I am not intimately familiar with this part of the curriculum, but the primary reason I could think of was that we might use it more later on, but a quick GitHub search seems to suggest this is the only occurrence of it

Asartea avatar Jun 13 '24 20:06 Asartea

We don't need to import the uuid library for this example; we can use the built-in crypto.randomUUID() function for each of those instead.

mao-sz avatar Jun 20 '24 21:06 mao-sz

@MaoShizhong So there's no technical or lesson-based reason we're using the uuid package then? Sounds like we can drop a package, which is always nice. :)

xandora avatar Jun 20 '24 22:06 xandora

An auto increment would also work fine.

cakegod avatar Jun 30 '24 19:06 cakegod

@asimn7 is this something you still wish to work on?

mao-sz avatar Aug 18 '24 21:08 mao-sz