use-uid
v1.0.0
Published
Return a unique id in React
Downloads
526
Readme
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