Skip to main content

Fetching data

Fetching data in React

Problem: Fetching in useEffect is clunky, verbose, and error prone.

Solution: Use one of these instead:

  1. React Server Components
  2. Tanstack Query
  3. Tanstack Router loaders
  4. React Router loaders
  5. Remix loaders
  6. RTK Query
  7. Apollo
  8. swr

Source: Cory House

Certains meta-frameworks like Next.js have built-in support for fetching data.

More details on Clean Architecture in React by Alex Kondov which explains why fetching data with useEffect is generally a bad idea.