UUID nodejs builtin library code example
Example 1: uuid v4 react
npm install uuid
import { v4 as uuidv4 } from 'uuid';
Example 2: uuid javascript
uuidv4() {
return 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
var r = (Math.random() * 16) | 0,
v = c == 'x' ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
}