DEV Community

Cover image for Fetch and display data from API in React js

Fetch and display data from API in React js

collegewap on July 16, 2022

When you develop an application, you will often need to fetch data from a backend or a third-party API. In this article, we will learn different wa...
Collapse
 
ecyrbe profile image
ecyrbe

Since react 18, using useEffect for data fetching should no more be an option (since now there is no guaranty it will not be called more than once).

Instead i highly suggest anyone to not reinvent the wheel and use an external data fetching hook library (react-query, swr, redux-toolkit rtk-query, @zodios/react, etc)

Collapse
 
collegewap profile image
collegewap

LOL, may be you should revisit some of the docs:

beta.reactjs.org/learn/synchronizi...

reactjs.org/docs/faq-ajax.html