DEV Community

Cover image for React Api definition
Sundar Joseph
Sundar Joseph

Posted on

React Api definition

The term "React API" can refer to several distinct concepts within the React ecosystem:
React's Built-in APIs:
These are the core functionalities provided by the React library itself. They include:
React Top-Level API: Functions like React.createElement(), React.Component, and React.Fragment.
Hooks API: Functions like useState(), useEffect(), useContext(), useReducer(), etc., which allow functional components to manage state and side effects.
Context API: Provides a way to share data across the component tree without prop drilling.
Error Boundaries: APIs like static getDerivedStateFromError() and componentDidCatch() for handling errors in components.
React DOM APIs:
These APIs are used for interacting with the Document Object Model (DOM) in the browser.
Client React DOM APIs (react-dom/client): Used for rendering React components on the client-side, including createRoot() and hydrateRoot().
Server React DOM APIs (react-dom/server): Used for rendering React components to HTML on the server-side for Server-Side Rendering (SSR).
External APIs used within React applications:
This refers to the process of making HTTP requests from a React application to external web services (like RESTful APIs) to fetch or send data. Common methods for this include:
Fetch API: A built-in browser API for making network requests.
Axios: A popular third-party library for making HTTP requests.
XMLHttpRequest (XHR): An older browser API for making network requests.
APIs of React-related Libraries/Frameworks:
Many libraries and frameworks built on top of or alongside React also expose their own APIs. Examples include:
React Redux API: Provides hooks like useSelector() and useDispatch() for interacting with a Redux store.
React Router API: Offers components and hooks for routing within a React application.
React Flow API: Provides components and utilities for building node-based editors and interactive diagrams.
In summary, while "React API" can broadly refer to any interface related to React, it most commonly refers to either the core built-in APIs of the React library or the methods used to interact with external web services from within a React application.

Top comments (0)