Uuid réagit
Command to install uuid(CMD-Windows):
npm install uuid
Importing uuid:
import { v4 as uuidv4 } from 'uuid';
uuidv4();
id:uuidv4() //Usage of uuid
Hurt Hawk
Command to install uuid(CMD-Windows):
npm install uuid
Importing uuid:
import { v4 as uuidv4 } from 'uuid';
uuidv4();
id:uuidv4() //Usage of uuid
npm install uuid
import { v4 as uuidv4 } from 'uuid';
import React from 'react'
import uuid from 'react-uuid'
const array = ['one', 'two', 'three']
export const LineItem = item => <li key={uuid()}>{item}</li>
export const List = () => array.map(item => <LineItem item={item} />)
function uuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
var userID=uuid();//something like: "ec0c22fa-f909-48da-92cb-db17ecdb91c5"