0% found this document useful (0 votes)
4 views

Built-in React APIs – React

The document provides an overview of built-in React APIs that are useful for defining components, including createContext, forwardRef, lazy, memo, startTransition, and act. It also introduces the use API for accessing resources like Promises or context without including them in the component's state. The document serves as a reference for modern React APIs and their applications.

Uploaded by

dungeon.dad87
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Built-in React APIs – React

The document provides an overview of built-in React APIs that are useful for defining components, including createContext, forwardRef, lazy, memo, startTransition, and act. It also introduces the use API for accessing resources like Promises or context without including them in the component's state. The document serves as a reference for modern React APIs and their applications.

Uploaded by

dungeon.dad87
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

20/02/2025, 09:07 Built-in React APIs – React

v19

API REFERENCE

Built-in React APIs


In addition to Hooks and Components, the react package exports
a few other APIs that are useful for defining components. This
page lists all the remaining modern React APIs.

createContext lets you define and provide context to the child


components. Used with useContext .
forwardRef lets your component expose a DOM node as a ref to the
parent. Used with useRef .
lazy lets you defer loading a component’s code until it’s rendered for the
first time.
memo lets your component skip re-renders with same props. Used with
useMemo and useCallback .

startTransition lets you mark a state update as non-urgent. Similar to


useTransition .

act lets you wrap renders and interactions in tests to ensure updates
have processed before making assertions.

Resource APIs
Resources can be accessed by a component without having them as part of
their state. For example, a component can read a message from a Promise or
read styling information from a context.

To read a value from a resource, use this API:

use lets you read the value of a resource like a Promise or context.

https://react.dev/reference/react/apis 1/3
20/02/2025, 09:07 Built-in React APIs – React

function MessageComponent({ messagePromise }) {


const message = use(messagePromise);
const theme = use(ThemeContext);
// ...
}

PREVIOUS

<Suspense>

NEXT

act

Copyright © Meta Platforms, Inc

uwu?

Learn React API Reference

Quick Start React APIs

Installation React DOM APIs

Describing the UI

Adding Interactivity

Managing State

Escape Hatches

Community More

Code of Conduct Blog

Meet the Team React Native

https://react.dev/reference/react/apis 2/3
20/02/2025, 09:07 Built-in React APIs – React

Docs Contributors Privacy

Acknowledgements Terms

https://react.dev/reference/react/apis 3/3

You might also like