React Hooks
The React snippet collection contains function components and reusable hooks for React 16.
Handles asynchronous calls.
Handles the event of clicking inside the wrapped component.
Handles the event of clicking outside of the wrapped component.
Executes a callback immediately after a component is mounted.
Executes a callback immediately before a component is unmounted and destroyed.
Copies the given text to the clipboard.
Debounces the given value.
Implements
fetch
in a declarative manner.Implements
setInterval
in a declarative manner.Checks if the current environment matches a given media query and returns the appropriate value.
Checks if the client is online or offline.
Returns a stateful value, persisted in
localStorage
, and a function to update it.Stores the previous state or props.
Checks if the code is running on the browser or the server.
Implements
setTimeout
in a declarative manner.