2.0.0 • Published 4 years ago
@bscop/use-id v2.0.0
use-id
A React hook to generate a very-likely unique id, persistent across re-renders.
Install
npm i @bscop/use-idUsage
Default behavior:
import useId from "@bscop/use-id";
useId(); // aS42hpCustom behavior:
import useId from "@bscop/use-id";
useId({ length: 10, prefix: "app" }); // app-aS42hpZn9Qlength: determine the length of the random part of the id (default is 6).prefix: define a prefix that will be prepended to the random id (default, no prefix).
Contribute
Read the guidelines.
Run tests
npm testCoverage
Coverage reports are hosted on codecov.
npm run badge:coverage -- --token=<guid>Bruno Scopelliti\ www.brunoscopelliti.com