idhook
v1.0.2
Published
Generate unique ids to use in your HTML with a very intuitive API.
Downloads
2
Maintainers
Readme
idhook
Generate unique ids to use in your HTML with a very intuitive API.
Install
npm install --save idhook
Usage
import React from "react";
import { useUniqueId } from "idhook";
const App = () => {
const id = useUniqueId();
return (
<form>
<label htmlFor={id("name")}>Name</label>
<input id={id("name")} name="name" />
<label htmlFor={id("email")}>Name</label>
<input id={id("email")} name="email" />
</form>
);
};
Typescript
Works out of the box.
License
MIT © anilanar
This hook is created using create-react-hook.