react-native-unique-id
Version:
generates a guid and stores it in the async store
35 lines (24 loc) • 1.49 kB
Markdown
# react-native-unique-id
generates a guid and stores it in the async store
This is supposed to identify the device / user.
It creates a guid if no exists and stores it in the AsyncStorage.
If a Guid exists, this will be returned
[](https://www.npmjs.com/package/react-native-unique-id) [](https://www.npmjs.com/package/react-native-unique-id) [](https://travis-ci.org/stockulus/react-native-unique-id) [](http://standardjs.com/) [](https://opensource.org/licenses/MIT)
### Usage
```bash
npm install react-native-unique-id --save
```
```js
const uniqueId = require("react-native-unique-id");
uniqueId()
.then(id => console.log(id))
.catch(error => console.error(error));
// or callback style
uniqueId((error, id) => {
if (error) return console.error(error);
console.log(id);
});
```
---
[](https://twitter.com/stockulus)
[](https://github.com/stockulus/react-native-unique-id)