The React snippet collection contains function components and reusable hooks for React 16.
React, Hooks
Adds an event listener for the specified event type on the given element.
React, Hooks
Creates a stateful value from the fields in a form.
React, Hooks
Checks if the current environment matches a given media query and returns the appropriate value.
React, Hooks
Copies the given text to the clipboard.
React, Hooks
Observes visibility changes for a given element.
React, Hooks
Creates a stateful Set
object, and a set of functions to manipulate it.
React, Hooks
Creates an error dispatcher.
React, Hooks
Executes a callback immediately after a component is mounted.
React, Hooks
Executes a callback immediately before a component is unmounted and destroyed.
React, Hooks
Watches for changes made to the DOM tree, using a MutationObserver
React, Hooks
Implements setTimeout()
in a declarative manner.
React, Hooks
Creates a stateful value with a default fallback if it's null
or undefined
, and a function to update it.
React, Hooks
Eesolves to useEffect()
on the server and useLayoutEffect()
on the client.
React, Hooks
Implements setInterval()
in a declarative manner.
React, Hooks
Stores the previous state or props.