The React snippet collection contains function components and reusable hooks for React 16.
React, Hooks
Creates a portal, allowing rendering of children outside the parent component.
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
Executes a callback whenever the window is scrolled.
React, Hooks
Executes a callback whenever the window is resized.
React, Hooks
Creates a stateful value that is persisted to localStorage
, and a function to update it.
React, Hooks
Runs an animating function, calling it before every repaint.
React, Hooks
Creates a stateful value that is persisted to sessionStorage
, and a function to update it.
React, Hooks
Handles the beforeunload
window event.
React, Hooks
Creates a stateful value, and a function to update it by merging the new state provided.
React, Hooks
Executes a callback immediately after a component is updated.
React, Hooks
Debounces the given value.
React, Hooks
Creates a stateful Map
object, and a set of functions to manipulate it.
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
Delays creating a stateful value until some condition is met.