Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

API reference

React 19+ API reference

advanced React 19 patterns and performance

Identifiers
101
With full guides
68
Types
7

Topics covered

  • The use() hook
  • Actions & useActionState
  • useOptimistic
  • Server Components
  • Suspense & transitions
  • Memoisation done right
  • Refs & imperative handle
  • Concurrent rendering

Class

NameWhat it does
PureComponentPureComponent is a React class base that shallowly compares props and state to skip unnecessary re-renders. It supports the Component APIs but is mainly intended for existing class components, since new code should generally use functions.
ComponentReact.Component is the base class for class-based React components. Extend it and implement render; however, function components are recommended for new code.

Component

NameWhat it does
SuspenseSuspense displays a fallback while descendant UI is not ready, then reveals that UI when it can render. Use boundaries to define loading regions and coordinate progressive or streamed content.
StrictModeStrictMode enables extra development-only checks for a component subtree. It helps reveal impure rendering, missing Effect or ref cleanup, and deprecated API usage early.
FragmentFragment groups multiple JSX elements without adding a wrapper node to the DOM. Use <>...</> for simple groups, or explicit <Fragment> when a key or ref is needed.
Profiler<Profiler> measures a React subtree’s rendering performance programmatically. Give it an id and an onRender callback to receive information about committed updates and their timing.
SuspenseListComponent
ViewTransition<ViewTransition> opts a component subtree into browser View Transition animations during React Transitions and Suspense updates. It is currently available only in React’s Canary and Experimental channels.
Activity<Activity> hides or reveals children while preserving their UI, internal state, and DOM. Hidden boundaries clean up Effects and process updates at lower priority; visible boundaries restore state and recreate Effects.

Function

NameWhat it does
memomemo wraps a component so React can skip parent-driven re-renders when its props are unchanged. It improves performance opportunistically, but does not guarantee that a component will never render.
startTransitionstartTransition marks synchronous state updates as non-urgent Transitions. React can render the affected UI in the background while keeping urgent interactions responsive.
createContextcreateContext creates a context object with a static fallback value. Providers supply values to descendants, which can read the nearest value with useContext.
lazylazy defers loading a component’s code until its first render. Wrap the lazy component, or an ancestor, in Suspense to show fallback content while the module loads.
createPortalcreatePortal renders React children into a different part of the DOM while keeping them in the rendering component's React tree. It is commonly used for modals, tooltips, and other UI that must escape a container.
flushSyncflushSync forces React to synchronously process updates inside a callback, making the DOM update immediately. Use it sparingly, mainly when integrating with code that needs to read the DOM right away.
createRootcreateRoot creates a React root connected to a browser DOM element. Call the returned root.render to display React content, or root.unmount to remove the rendered tree.
hydrateRoothydrateRoot attaches React to HTML previously rendered on the server, making it interactive in the browser. The client React tree must produce output identical to the server-rendered HTML.
cachecache memoizes a function's results for React Server Components during a server request. Matching arguments reuse prior work, while cache misses execute and store the function result.
forwardRefforwardRef lets a component expose a child DOM node or imperative handle through a parent ref. In React 19, it is no longer necessary for function components because ref can be received directly as a prop, and it will be deprecated in a future release.
cloneElementCreates a new React element from an existing valid element, selectively overriding its props, key, ref, or children. The original element remains unchanged.
isValidElementChecks whether a value is a React element. It recognizes JSX and createElement results, but not every renderable React node.
createElementcreateElement constructs a React element from a type, props, and optional children. It is the programmatic alternative to JSX when direct element construction is needed.
actact is a test helper that flushes React updates caused by rendering and interactions before assertions. Use its asynchronous form to make test behavior closer to React in the browser.
createRefFunction
preloadpreload from react-dom gives the browser an early hint to fetch a resource you expect to use. It can reduce waiting for fonts, stylesheets, images, scripts, and other supported resources.
preinitpreinit from react-dom eagerly fetches and initializes an external script or stylesheet. Scripts execute after download; stylesheets are inserted and applied immediately.
preconnectpreconnect hints that the browser should establish a connection to a server whose resources you expect to request. Calling it early can reduce resource-loading latency if the browser honors the hint.
prefetchDNSHints that the browser should resolve a server's IP address ahead of an expected resource request. Use it to reduce DNS delay for anticipated external resources, while remembering that the browser may ignore the hint.
requestFormResetFunction
createFactoryFunction
findDOMNodefindDOMNode located the closest browser DOM node rendered by a mounted class-component instance. React 19 removed this deprecated legacy API; use a direct DOM ref instead.
useFormStateFunction
hydrateFunction
renderDeprecated legacy API that mounts a React node into a browser DOM element. React 19+ code should use createRoot from react-dom/client instead.
renderToStringRenders a React tree to an HTML string, typically on the server for the initial page response. Hydrate the resulting markup with hydrateRoot in the browser to make it interactive.
renderToStaticMarkupRenders a non-interactive React tree to an HTML string, typically on the server. Its output cannot be hydrated, so use it for static markup rather than interactive applications.
renderToReadableStreamRenders a complete React tree as HTML into a Web ReadableStream, intended for streaming server rendering in Web Streams environments. The returned promise resolves when the shell is ready.
renderToPipeableStreamRenders a React tree as HTML into a pipeable Node.js Stream. Use onShellReady for progressive streaming or onAllReady when the complete output must be ready first.
prerenderprerender asynchronously generates static HTML for a React tree as a Web Stream. It waits for data required by Suspense before resolving, making it suitable for static site generation.
prerenderToNodeStreamPre-renders a complete React tree to static HTML through a Node.js Stream. It waits for required data before resolving, making it useful for static site generation.
unstable_batchedUpdatesFunction

Hook

NameWhat it does
useStateHook
useEffectHook
useMemouseMemo caches the result of a calculation between component renders. React reuses that result while its dependencies remain unchanged and recalculates it when they change.
useCallbackuseCallback caches a function definition between component renders. React reuses the cached function while its dependencies remain unchanged.
useRefHook
useContextuseContext reads and subscribes a component to a context. It returns the nearest provider's value, or the context's defaultValue when no provider is above the component.
useReact's use API reads a Promise or context during rendering. Promise reads suspend while pending, and unlike ordinary Hooks, use can be called in conditions and loops.
useActionStateuseActionState updates component state from a form action's result. It returns the latest state, a form-compatible action, and a pending flag.
useOptimisticuseOptimistic lets a component display temporary optimistic state while an Action is pending. After the Action finishes or errors, React returns to the source value.
useFormStatususeFormStatus lets a component rendered inside a form read the status of its parent form submission. Use it to show pending UI, inspect submitted data, or access the form method and function action.
useTransitionuseTransition lets a component mark non-urgent state updates as background Transitions. It returns a pending flag and a function for starting them.
useDeferredValueuseDeferredValue lets you defer updating a non-critical part of the UI so urgent updates can appear first. It returns a value that may temporarily lag behind the latest input.
useReducerHook
useIduseId generates unique strings for connecting elements through accessibility attributes. Call it at the top level of a component or custom Hook, with no arguments.
useImperativeHandleuseImperativeHandle customizes the value exposed through a ref. In React 19, a component can receive ref as a prop and expose a restricted object of imperative methods instead of its underlying DOM node.
useLayoutEffectuseLayoutEffect runs before the browser repaints, making it suitable for layout reads and visual corrections that must not flicker. Prefer useEffect unless the work must happen before paint.
useSyncExternalStoreuseSyncExternalStore lets a component read from and subscribe to an external store. It supports server rendering through an optional server snapshot and re-renders when the snapshot changes.
useDebugValueuseDebugValue lets a custom Hook expose a readable label or value in React DevTools. An optional formatter controls how the value appears when the component is inspected.
useInsertionEffectuseInsertionEffect lets CSS-in-JS libraries insert styles before layout effects run. It is a specialized client-side hook, not a general replacement for useEffect or useLayoutEffect.

Type Alias

NameWhat it does
ReactNodeType Alias
ReactElementReact elements are UI descriptions created by JSX or createElement. Use isValidElement to distinguish them from other React nodes and arbitrary values.
FCType Alias
PropsWithChildrenType Alias
ComponentPropsType Alias
ComponentPropsWithoutRefType Alias
ComponentPropsWithRefType Alias
ComponentTypeType Alias
ElementTypeType Alias
RefObjectType Alias
MutableRefObjectMutableRefObject is the pre-React-19 TypeScript concept for a ref whose current value can be assigned. In React 19, useRef returns the unified mutable RefObject shape instead; useRef requires an initial argument.
DispatchDispatch is the function returned by useReducer for requesting a state update. Pass it one action; React gives that action and the current state to the reducer, then re-renders with the reducer's result.
SetStateActionSetStateAction<S> is the union accepted by a React state setter: either a value of type S or a function that calculates the next S from previous state. It supports direct replacement and state-dependent updates.
ReducerReducer is the function passed to useReducer to define how actions transform current state into next state. React calls it during dispatch and uses its return value for the next render.
ContextcreateContext defines a context object for passing information through a component tree without explicitly forwarding it as props. Its default value is used only when no matching provider is found above the reader.
RefType Alias
KeyType Alias
CSSPropertiesReact.CSSProperties types an object passed to a component’s style prop. It supports valid CSS properties and editor autocomplete for inline styles.
SyntheticEventReact.SyntheticEvent is the general TypeScript type for React event objects. It follows the DOM Event model while smoothing over browser inconsistencies and exposing the original event through nativeEvent.
ChangeEventReact.ChangeEvent<T> types a React DOM change event for a specific element type. Use it most directly when an extracted handler needs an explicit event annotation.
MouseEventMouseEvent is React’s handler type for mouse interactions on built-in elements. Its event object exposes button state, modifier keys, coordinates, movement, and the related target.
FormEventType Alias
KeyboardEventType Alias
FocusEventReact.FocusEvent is the event type for React focus handlers such as onFocus and onBlur. Its bubbling behavior lets parent handlers analyze focus movement using event targets and relatedTarget.
PointerEventPointerEvent is React’s handler type for pointer interactions on DOM components. Its event object combines pointer-specific information with inherited mouse-event properties.
RefCallbackRefCallback is the function form of a React ref. React calls it with the attached DOM node and, in React 19, can run a cleanup function returned by the callback when the node detaches.
ForwardRefRenderFunctionForwardRefRenderFunction is the render-callback shape used by React's forwardRef pattern: it receives props and a ref and returns JSX. In React 19, new components should generally accept ref as a prop directly because forwardRef is no longer necessary.
ElementRefType Alias
ComponentRefType Alias
ReactPortalcreatePortal renders React children into a different part of the DOM while preserving their place in the React tree. It is commonly used for UI such as modals that must escape container boundaries.
UsableType Alias
ExoticComponentType Alias
JSX.ElementType Alias
PropsWithRefType Alias
DependencyListDependencyList is the fixed-length array of reactive values used by React hooks such as useMemo, useEffect, and useCallback. React compares each entry with its previous value using Object.is to decide whether dependent work should run again.
EffectCallbackType Alias
TransitionFunctionType Alias

Const

NameWhat it does
ChildrenChildren provides utilities for counting, iterating, transforming, asserting, and normalizing a component’s children prop. Because children is opaque, use these methods instead of assuming an array shape.
versionConst

Directive

NameWhat it does
use clientThe 'use client' directive marks a module and its transitive dependencies as client code in React Server Components. It creates a server-client boundary so interactive components can run in the browser.
use server'use server' marks an async server-side function as callable from client-side code. Client calls become network requests, with serializable arguments and results handled by the framework.

Search across every package and filter by type in your dashboard.

Start learning