React Hooks
The React snippet collection contains function components and reusable hooks for React 16.
Executes a callback immediately after a component is mounted.
Executes a callback immediately before a component is unmounted and destroyed.
Stores the previous state or props.
Provides a boolean state variable that can be toggled between its two states.
Handles the event of clicking inside the wrapped component.
Handles the event of clicking outside of the wrapped component.
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.
Checks if the code is running on the browser or the server.
Implements
setTimeout
in a declarative manner.Handles the
beforeunload
window event.Handles asynchronous calls.