1import React from 'react'
2import uuid from 'react-uuid'
3
4const array = ['one', 'two', 'three']
5
6export const LineItem = item => <li key={uuid()}>{item}</li>
7
8export const List = () => array.map(item => <LineItem item={item} />)
9
1function uuid() {
2 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
3 var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
4 return v.toString(16);
5 });
6}
7
8var userID=uuid();//something like: "ec0c22fa-f909-48da-92cb-db17ecdb91c5"