The React snippet collection contains function components and reusable hooks for React 16.
React, Hooks
Enables body scroll locking.
React, Hooks
Executes a callback whenever the window is scrolled.
React, Hooks
Checks if the client is online or offline.
React, Hooks
Executes a callback whenever the window is resized.
React, Hooks
Runs an animating function, calling it before every repaint.
React, Hooks
Handles the beforeunload
window event.
React, Hooks
Creates a stateful value that is persisted to localStorage
, and a function to update it.
React, Hooks
Creates a stateful value that is persisted to sessionStorage
, and a function to update it.
React, Hooks
Executes a callback immediately after a component is updated.
React, Hooks
Creates a stateful Map
object, and a set of functions to manipulate it.
React, Hooks
Creates a stateful value, and a function to update it by merging the new state provided.
When working with multiple useState
hooks in React, things can get a bit complicated while debugging. Luckily, there's an easy way to label these values.
React, Hooks
Handles the event of clicking inside the wrapped component.
React, Hooks
Handles the event of clicking outside of the wrapped component.
React, Hooks
Debounces the given value.