usehooks
usehooks copied to clipboard
A collection of modern, server-safe React hooks – from the ui.dev team
Here is a custom hook I extracted recently from a project. It basically allows the user to use a selector query to grab a number of DOM nodes, and then...
OG share image still says "one new recipe every day" and we're switching to a more flexible schedule (prob twice a week).
useType makes it super easy to use [Microstates](https://github.com/microstates/microstates.js)' composable runtime type system with React. Implementation can be found in [@microstates/react](https://github.com/microstates/react) repo. Example usage can be found in [TodoMVC with Microstates...
Returns the current fullscreen state, and a toggle function if fullscreen is available and enabled in the browser. ``` import { useEffect, useState } from 'react'; const doc = document;...
**What is the current behavior?** On iOS, the body is still scrollable when overlay is opened even though `useLockBodyScroll` is used. It works fine in Desktops and android phones though....
**As the title, when I use `useEventListener` to bind click event to dom element, it's not work.** ``` function App() { const itemRef = useRef(null); const onMouseEnter = (e) =>...
The [useMemo demo](https://codesandbox.io/s/jjxypyk86w) is currently not working, the error message is: _Could not find module in path: 'react/jsx-runtime' relative to '/src/index.js'_ Just update `react` and `react-dom` to the latest version...
`useLocalStorage` will call `window.dispatchEvent(new Event("local-storage"))`. Then there's ``` const onStorageChange = React.useEffectEvent((event) => { if (event?.key && event.key !== key) { return; } setLocalState(readValue()); }); React.useEffect(() => { window.addEventListener("storage", onStorageChange);...
**Reproduction steps:** 1. Visit the "useMeasure" webpage at https://usehooks.com/usemeasure. 2. Scroll down to the example section 3. In the example code, observe that the example is referencing the `useLongPress` hook...
Currently `useMap` only allows a single type parameter (for the key). It makes sense to be able to type the value as well. Example ```ts const myMap = useMap(); ```