React useUpdate hook
Forces the component to re-render when called.
The React snippet collection contains function components and reusable hooks for React 18.
Forces the component to re-render when called.
Renders a table with rows dynamically created from an array of primitives.
Renders an uncontrolled <input>
element that uses a callback function to inform its parent about value updates.
Implements setInterval()
in a declarative manner.
Renders an uncontrolled range input element that uses a callback function to pass its value to the parent component.
Executes a callback immediately after a component is mounted.
Executes a callback immediately before a component is unmounted and destroyed.
Avoid unnecessary re-runs by using primitive dependencies in your React effect.
Creates a stateful value with a default fallback if it's null
or undefined
, and a function to update it.
Runs a callback at most once when a condition becomes true.
Resolves to useEffect()
on the server and useLayoutEffect()
on the client.
Sets the title of the page
Provides a boolean state variable that can be toggled between its two states.
Testing React components that use portals can be difficult until you understand what you really need to be testing.
Renders an uncontrolled <textarea>
element that uses a callback function to pass its value to the parent component.
Renders a password input field with a reveal button.
Stores the previous state or props.
Renders a link formatted to send an email (mailto:
link).
Learn the differences between PropTypes.objectOf()
and PropTypes.shape()
and where to use each one with this quick guide.
Multiple useState
hooks in React can complicate things while debugging. Luckily, there's an easy way to label these values.