The React snippet collection contains function components and reusable hooks for React 16.
Creates a stateful Set
object, and a set of functions to manipulate it.
React, Hooks · Nov 1, 2021
Observes visibility changes for a given element.
React, Hooks · Sep 10, 2021
Checks if the current environment matches a given media query and returns the appropriate value.
React, Hooks · Oct 13, 2021
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 · Nov 7, 2021
Executes a callback immediately after a component is mounted.
React, Hooks · Oct 13, 2021
Executes a callback immediately before a component is unmounted and destroyed.
React, Hooks · Oct 13, 2021
Delays creating a stateful value until some condition is met.
React, Hooks · Dec 15, 2021
Watches for changes made to the DOM tree, using a MutationObserver
React, Hooks · Nov 23, 2021
Resolves to useEffect()
on the server and useLayoutEffect()
on the client.
React, Hooks · Oct 13, 2021
Creates a stateful value with a default fallback if it's null
or undefined
, and a function to update it.
React, Hooks · Oct 23, 2021