The React snippet collection contains function components and reusable hooks for React 16.
React, Hooks
Wrapping your mind around React hooks and how they interact with setInterval()
can be difficult. Here's a guide to get you started.
React, Hooks
Returns a stateful value, persisted in localStorage
, and a function to update it.
React, Hooks
Tracks the browser's location hash value, and allows changing it.
React, Hooks
Listens for changes in the pressed state of a given key.
React, Hooks
Tracks the browser's location search param.
React, Hooks
Dynamically loads an external script.
React, Hooks
Handles the event of hovering over the wrapped component.
React, Hooks
Tracks the dimensions of the browser window.
React, Hooks
Checks if the code is running on the browser or the server.
React, Hooks
Implements fetch()
in a declarative manner.
React, Hooks
Creates a stateful value, returning a getter and a setter function.
React, Hooks
Handles asynchronous calls.
React, Hooks
Enables body scroll locking.
React, Hooks
Checks if the client is online or offline.
React, Hooks
Executes a callback whenever an event occurs on the global object.