@nanlabs/react-hooks
v0.6.0
Published
<!--lint disable double-link awesome-heading awesome-git-repo-age awesome-toc-->
Downloads
123
Readme
This package contains multiple hooks that can be used in your React application!
Installation
npm install @nanlabs/react-hooks
Usage
The following example shows how one of the multiple hooks provided by this library can be used.
In the example bellow we use useDebounce
to debounce the value of an input.
You can find more examples in the documentation.
import React, { useState } from "react";
import { useDebounce } from "@nanlabs/react-hooks";
const Component = () => {
const [value, setValue] = useState("");
const debouncedValue = useDebounce(value, 500);
return (
<div>
<input value={value} onChange={(e) => setValue(e.target.value)} />
<p>Debounced value: {debouncedValue}</p>
</div>
);
};