1. react-native-uuid
⚠️ Caution
react-native-uuid
appears to support up to v5 at the time of writing.
npm install react-native-uuid
import uuid from 'react-native-uuid';
uuid.v4();
2. uuid (and plus)
npm install uuid react-native-get-random-values
npx pod-install
import 'react-native-get-random-values'; // This must precede `uuid`
import { v4 as uuidv4 } from 'uuid';
uuidv4();
Top comments (4)
I really don't understand why not using the browser built-in
crypto.randomUUID()
That is v4 only. But your comment is also good if v4 is enough.
Yes :) but your article is for v4 too
Yeah. The examples might be too simple. Both libs support other versions as well as v4.