Files
react.dev/src/content/reference/react/apis.md
2024-04-24 15:58:09 -04:00

1.7 KiB

title
title
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.



Resource APIs {/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:

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