A set of React hooks for Q Blockchain frontend projects.
To install the library, run the following command:
yarn add @q-dev/react-hooks
or
npm install @q-dev/react-hooks
import { useInterval } from '@q-dev/react-hooks'
export default function App() {
const [count, setCount] = useState(0)
useInterval(() => {
setCount(count + 1)
}, 1000)
return <div>{count}</div>
}
Hook | Description |
---|---|
useAnimateNumber |
Animate number from one value to another. |
useChangesListener |
Listen for changes in the value. |
useCopyToClipboard |
Copy text to clipboard. |
useEventCallback |
useCallback for events. |
useEventListener |
Event listener handlers. |
useInfinityNumber |
Infinity number animation. |
useInterval |
Call a function at a specified interval. |
useLocalStorage |
Manage local storage. |
useOnClickOutside |
Handle click outside of the element. |
useOnScreen |
Detect if the element is visible on the screen. |
useWindowSize |
Get window size. |
We welcome contributions to the library. If you would like to submit a pull request, please make sure to follow our code style.
This project and everyone participating in it is governed by the Q React Hooks Code of Conduct. By participating, you are expected to uphold this code.