usehooks
usehooks copied to clipboard
A collection of modern, server-safe React hooks – from the ui.dev team
``` /* useRefArray.js */ export default (list) => { const ref = React.useRef([]); React.useEffect(() => { ref.current = ref.current.slice(0, list.length); }, [list]); const getter = (index) => { return (element)...
Had this issue when I used it. useScript adds the scripts to the cache before it was loaded. That means that if you in edge cases where you use the...
As addition to the existing useRef hook I think it's useful to have a useVariable hook which mimics the semantics of useState but do not trigger a component rerender. It...
React hook that enables easy use of the idle until urgent component loading strategy. This strategy involves fetching resources lazily - either whenever the browser is next idle, or when...
Maybe you're at the point where you accept Typescript-contributions - this can of course be used without typescript, but it really shines with typescript ;) I've got a prototype of...
Let me know if there is anything else you need or see missing from this example?
Not sure if anyone would be interested in this. But would be good for a lot of interactive content or other mouse tracking components. https://github.com/hamfz/react-use-mouse-move
Based on idea from this post by Bojan Aleksic: https://itnext.io/handling-large-lists-and-tables-in-react-238397854625 With Hooks it became much simpler https://github.com/BLooperZ/lazy-batch-loader/blob/master/src/lib/components/LazyBatchLoader.js Usage: https://github.com/BLooperZ/lazy-batch-loader/blob/master/src/examples/LazyListRendererHook.js There's a demo application on same repository (git clone and npm...
Allows creating a 'load more' button that paginates. In theory, one could build an async version of this pretty easily. ```typescript import * as R from "ramda"; import { useState...
Hey! I just created a new hook which makes use of the browser history state, hope you find this one interesting. It's main goal is for inside projects that have...