React useHover hook
Handles the event of hovering over the wrapped component.
The React snippet collection contains function components and reusable hooks for React 18.
Handles the event of hovering over the wrapped component.
Returns a stateful value, persisted in localStorage
, and a function to update it.
When working with stateful code, you can run into issues realted to complexity and readability. Oftentimes, they are easily fixable.
Implements fetch()
in a declarative manner.
Creates a stateful Set
object, and a set of functions to manipulate it.
As powerful as React is, it is also quite fragile at places. Did you know that a few lines can easily break your entire React application?
Checks if the code is running on the browser or the server.
Renders a carousel component.
Renders an image that supports lazy loading.
Delays creating a stateful value until some condition is met.
Watches for changes made to the DOM tree, using a MutationObserver
Dynamically loads an external script.
Renders a toggle component.
Listens for changes in the pressed state of a given key.
Runs an animating function, calling it before every repaint.
Renders a tooltip component.
Executes a callback immediately after a component is updated.
Tracks the dimensions of the browser window.
Renders an uncontrolled <select>
element that uses a callback function to pass its value to the parent component.
Creates a stateful value, returning a getter and a setter function.
Wrapping your mind around React hooks and how they interact with setInterval()
can be difficult. Here's a guide to get you started.
Executes a callback whenever an event occurs on the global object.
Executes a callback whenever the window is scrolled.
Testing Redux-connected components is pretty common. Learn how to use this simple utility function to speed up your testing.