PoRPlace of Reference
Topics
  • 1 soon
  • 1 soon
  • 3 soon
  • 10 soon
  • 4 soon
    • Overview
    • How Frontends Talk to a Database
    • Fetching Data with useEffect
    • Loading and Error States
    • Moving HTTP Code Out of Components
    • Sending Data and Optimistic Updates
    • Race Conditions and Cancelling Requests
    • Summary
    • use(promise) + SuspenseComing soon
    • Fetching in Server ComponentsComing soon
    • Server ActionsComing soon
    • Route HandlersComing soon
  • 2 soon
  • 1 soon
  • 4 soon
  • 3 soon
  • 9 soon
  • 1 soon
  • 3 soon
Frameworks
  • 7 soon
From react.dev
  • 2 soon
  • 4 soon
  • 3 soon
  • 2 soon
React ↔ Angular reference
Coming fromFrom

7 entries · 14-question quiz

Sending HTTP Requests (e.g. Connecting to a Database)

React ↔ Angular reference. React examples use React 19 + TypeScript. Angular examples use modern Angular (standalone components, signals, HttpClient, httpResource(), @if/@for).

Test yourself

14 questions

  1. 1
    How Frontends Talk to a Database

    A React (or Angular) app never connects to a database directly. It sends HTTP requests to a backend API, and the backend reads and writes the database.

  2. 2
    Fetching Data with useEffect

    Loading data when a component appears, by running fetch inside an effect.

  3. 3
    Loading and Error States

    Tracking whether a request is in progress or has failed, so the UI can show a spinner or an error message.

  4. 4
    Moving HTTP Code Out of Components

    Putting request logic in a separate module so components only call simple, typed functions.

  5. 5
    Sending Data and Optimistic Updates

    An optimistic update changes the UI immediately, before the server confirms, and rolls back if the request fails.

  6. 6
    Race Conditions and Cancelling Requests

    A race condition happens when an older, slower request finishes after a newer one and overwrites its result.

  7. 7
    Summary