In my application I'll store the some data's, so I would use the AsyncStorage method but Now need to create a uuid because AsyncStorage name for same to updated.
any alternative idea for this scenario or how to create UUID.
Not used any npm pakage.
In my application I'll store the some data's, so I would use the AsyncStorage method but Now need to create a uuid because AsyncStorage name for same to updated.
any alternative idea for this scenario or how to create UUID.
Not used any npm pakage.
First run the script to install npm package for react-native-uuid
npm install react-native-uuid --save
After that import the module in your file by
import uuid from 'react-native-uuid';
//usage
var testUUID = uuid.v1();
You might get an error showing that
module buffer does not exist in react native
if so, install that module too,
npm install buffer --save
Hope this helps!
Without using a npm already tested code you can create you own function that will generate an UUID for you.
See this question
What worked for me was to install uuid-random using.
npm i uuid-random
Then to import,
import uuid from 'uuid-random';
Finally to use,
uuid()
We just recently released an updated version of react-native-uuid, fully rewritten in TypeScript.
Here's how to use it:
npm install react-native-uuid
import uuid from 'react-native-uuid';
uuid.v4(); // ⇨ '11edc52b-2918-4d71-9058-f7285e29d894'
More details: https://github.com/eugenehp/react-native-uuid