Components
React provides base classes and utilities for defining components:Component- Base class for React components using ES6 classesPureComponent- Component variant with built-in shallow comparison for props and state
Creating Elements
These APIs let you create React elements programmatically:createElement(type, props, ...children)- Create and return a new React elementcloneElement(element, props, ...children)- Clone and return a new React elementisValidElement(object)- Verify if an object is a React element
Refs
Refs provide a way to access DOM nodes or React elements:createRef()- Create a ref object that can be attached to elements via the ref attribute
Fragments
Fragments let you group multiple elements without adding extra DOM nodes:Context
Context provides a way to pass data through the component tree:createContext(defaultValue)- Create a Context object for sharing data across the component tree
Higher-Order Components
These APIs wrap components to add additional functionality:forwardRef(render)- Forward refs to child componentsmemo(Component, compare?)- Memoize a component to skip re-renders with same propslazy(load)- Lazy-load a component with dynamic import
Children Utilities
Utilities for working with theprops.children data structure:
Children.map(children, fn)- Map over children with automatic key handlingChildren.forEach(children, fn)- Iterate over childrenChildren.count(children)- Count the number of childrenChildren.toArray(children)- Convert children to a flat arrayChildren.only(children)- Assert that children contains only one child
Development Mode Components
These components enable additional checks and features during development:StrictMode- Enable strict mode checks for descendantsProfiler- Measure rendering performance of components
Suspense
Suspense lets you display fallback content while waiting for components to load:Suspense- Display fallback UI while children are loading
Hooks
Hooks let you use state and other React features in function components:State Hooks
useState(initialState)- Add state to function componentsuseReducer(reducer, initialArg, init?)- Manage complex state with a reducer
Effect Hooks
useEffect(setup, dependencies?)- Synchronize with external systemsuseLayoutEffect(setup, dependencies?)- Fires synchronously after all DOM mutationsuseInsertionEffect(setup, dependencies?)- Fires before any DOM mutations (for CSS-in-JS)
Ref Hooks
useRef(initialValue)- Create a mutable ref objectuseImperativeHandle(ref, createHandle, dependencies?)- Customize the ref value exposed to parent
Context Hook
useContext(Context)- Read context value
Performance Hooks
useMemo(calculateValue, dependencies)- Cache calculation resultsuseCallback(fn, dependencies)- Cache function definitions
Transition Hooks
useTransition()- Mark state updates as non-urgent transitionsuseDeferredValue(value, initialValue?)- Defer updating non-urgent parts of UIstartTransition(callback)- Mark updates in callback as transitions
Other Hooks
useId()- Generate unique IDs for accessibility attributesuseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot?)- Subscribe to external storesuse(promise)- Read the value of a Promise or ContextuseOptimistic(state, updateFn)- Show optimistic state during async operationsuseActionState(action, initialState, permalink?)- Manage state for form actionsuseDebugValue(value, format?)- Add a label in React DevTools for custom hooks
Caching
APIs for caching data and computations:cache(fn)- Cache function results across renderscacheSignal()- Create a signal for cache invalidation
Unstable APIs
These APIs are experimental and may change:unstable_SuspenseList- Coordinate loading states of multiple Suspense boundariesunstable_LegacyHidden- Hide subtree without unmountingActivity- Track and manage activity statesunstable_getCacheForType(resourceType)- Access cache for a specific resource typeunstable_useCacheRefresh()- Refresh cached resourcesunstable_Scope- Create scope for querying DOM elementsunstable_TracingMarker- Add markers for performance tracingViewTransition- Coordinate view transitionsunstable_startGestureTransition(callback)- Mark updates as gesture transitionsoptimisticKey- Special key for optimistic updates
Development-Only APIs
act(callback)- Wrap test code that renders or updates componentscaptureOwnerStack()- Capture the component stack for debugging
Version
version- Current React version string