The React snippet collection contains function components and reusable hooks for React 18.
Listens for changes in the pressed state of a given key.
React, Hooks · Sep 7, 2021
Runs an animating function, calling it before every repaint.
React, Hooks · Dec 29, 2021
Executes a callback immediately after a component is updated.
React, Hooks · Nov 9, 2021
Creates a stateful value, returning a getter and a setter function.
React, Hooks · Oct 27, 2021
Wrapping your mind around React hooks and how they interact with setInterval()
can be difficult. Here's a guide to get you started.
React, Hooks · Sep 28, 2021
Executes a callback whenever an event occurs on the global object.
React, Hooks · Dec 22, 2021
Executes a callback whenever the window is scrolled.
React, Hooks · Dec 8, 2021
Adds an event listener for the specified event type on the given element.
React, Hooks · Sep 1, 2021
Creates a stateful value, and a function to update it by merging the new state provided.
React, Hooks · Sep 23, 2021
Creates a portal, allowing rendering of children outside the parent component.
React, Hooks · Jan 5, 2022
Executes a callback whenever the window is resized.
React, Hooks · Dec 1, 2021
Creates a stateful value that is persisted to localStorage
, and a function to update it.
React, Hooks · Sep 13, 2021
Creates a stateful value that is persisted to sessionStorage
, and a function to update it.
React, Hooks · Sep 15, 2021