Don't install "uuid" package

Don't install "uuid" package

·

1 min read

Universally Unique IDs are great to use anywhere in our application where we need random and unique IDs.

In the past, we have always needed to reach for a library such as uuid in order to bring this into our applications.

If we put aside any immediate concerns over security or bundle size, a good philosophy is to prefer Web APIs over third-party libraries. With the (now very good) support for the Web Crypto API, we can avoid installing the uuid node package and instead use the Web Crypto API.

The Web Crypto API has a method randomUUID() and can be used as follows:

const UUID = crypto.randomUUID()