DEV Community

Discussion on: Fetch and display data from API in React js

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