Skip to content

Instantly share code, notes, and snippets.

@vre2h
Created July 20, 2018 19:45
Show Gist options
  • Save vre2h/7c725e5f56fde8a70418ed9b1b33e42a to your computer and use it in GitHub Desktop.
Save vre2h/7c725e5f56fde8a70418ed9b1b33e42a to your computer and use it in GitHub Desktop.
How to add unique id's for React key.
  1. Install node-uuid package
npm install --save node-uuid

Or yarn

yarn add node-uuid
  1. Import v4 function
import { v4 } from 'node-uuid';
  • You can use it just by calling
{id: v4()}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment