Skip to content

twinh/use-uid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

use-uid

Return a unique id in React

Install

yarn add use-uid

Usage

useUid(prefix, defaults)

import useUid from 'use-uid';

let cls = useUid('class-'); // Returns 'class-0'

let cls = useUid('class-'); // Returns 'class-1'

let cls = useUid('class-', 'class-custom'); // Returns 'class-custom'

let cls = useUid('cls-'); // Returns cls-2