carbon-design-system / ibm-products

A Carbon-powered React component library for IBM Products
https://ibm-products.carbondesignsystem.com
Apache License 2.0
96 stars 137 forks source link

Replace `uuidv4` with `useId` #3441

Open elycheea opened 1 year ago

elycheea commented 1 year ago

With React 18, we can now use the useId hook which enables us to remove uuidv4 from our dependencies.

jagathgj commented 1 year ago

@elycheea, @lee-chase we have a file named example.js which is the only file using uuid dependency and a resolver file for jest. And we also have a uuidv4 custom utility function that generates random ids. And Should we remove this uuidv4 custom utility function and use React's useID globally? Former is currently used for component naming, form input Ids, Keys etc. I have went through the react documentation on useId, and found it has some pitfalls as well. Please let me know your thoughts.