Import uuid but default export does not exists in react

Import UUID causing error with default export does not contain uuid. React UUID and Default Export Issue. Simple Fix

So I tried importing uuid but it would not work so I found this article online that showed me how to get it working. First, there are different versions.

import {v1 as uuid} from "uuid"; 
// import {v3 as uuid} from "uuid"; 
// import {v4 as uuid} from "uuid"; 
// import {v5 as uuid} from "uuid"; 

You need to choose which one will work for you.

If you are using an older version of the package you might need to use it like this.

import uuid from 'uuid/v1'
// import uuid from 'uuid/v3'
// import uuid from 'uuid/v4'
// import uuid from 'uuid/v5'

How to use the ID?

import {v4 as uuid} from 'uuid'
const id = uuid()