For identifying each user i am trying to generate unique id at the time of registration in react native.How is it possible? Thanks in advance
Asked
Active
Viewed 2,992 times
2
-
Will the ID be displayed to the user? Is this just a database ID? Will this ID be used in the URL to link to a user profile? – Kiril Jul 11 '17 at 09:07
-
No this ID will not be displayed to the user.I want this ID to be set as session.So that each time i can check whether the user is logged in or not. – Linu Sherin Jul 11 '17 at 09:20
-
When user registration call API and generate unique id on server after successful registration return unique id to app and save it – Nisarg Thakkar Jul 11 '17 at 09:22
-
So how do i generate unique id at registration? – Linu Sherin Jul 11 '17 at 09:33
-
reference : https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript – Arnav Yagnik Jul 11 '17 at 09:35
2 Answers
2
the best way is using an UUID generator. to install UUID generator use the two following cammands
$ npm install react-native-uuid-generator --save
$ react-native link react-native-uuid-generator
then import from 'react-native-uuid-generator'
import UUIDGenerator from 'react-native-uuid-generator';
for reference click here

Mujthaba
- 25
- 8
1
You can set a timestamp for every user as id, but uuid is the best solution.

Ali Eslamifard
- 565
- 3
- 11