Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Windows Tipps & SecurityTestMu AI Review: How AI is Solving the Quality Engineering Problem(23.09.2026 um 13:18 Uhr)
Windows Tipps & SecurityAmazon haut den kabellosen Dyson V8 Stabstaubsauger zum Tiefstpreis raus(24.09.2026 um 09:32 Uhr)
Windows Tipps & SecurityUpdates beheben etliche Schwachstellen in Foxit PDF Reader(24.09.2026 um 09:44 Uhr)
Windows Tipps & Security„Vom Experience Center zum monumentalen Signage-Projekt“(24.09.2026 um 10:30 Uhr)
Windows Tipps & SecurityTestMu AI Review: How AI is Solving the Quality Engineering Problem(23.09.2026 um 13:18 Uhr)
Windows Tipps & SecurityAmazon haut den kabellosen Dyson V8 Stabstaubsauger zum Tiefstpreis raus(24.09.2026 um 09:32 Uhr)
Windows Tipps & SecurityUpdates beheben etliche Schwachstellen in Foxit PDF Reader(24.09.2026 um 09:44 Uhr)
Windows Tipps & Security„Vom Experience Center zum monumentalen Signage-Projekt“(24.09.2026 um 10:30 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Day 5 of #100DaysOfCode — Fetching Data in React (useEffect + fetch + axios)

Data fetching is one of the most fundamental skills in modern React development. Whether you’re building dashboards, blogs, authentication systems, or e-commerce stores — your app almost always needs to get data from somewhere outside its…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Data fetching is one of the most fundamental skills in modern React development. Whether you’re building dashboards, blogs, authentication systems, or e-commerce stores — your app almost always needs to get data from somewhere outside itself.



In today’s session, I focused on understanding what data fetching actually is, why we need it, and how to use fetch() and axios inside React with useEffect.



Let’s break it all down in simple terms.









What Is Data Fetching?



Data fetching simply means getting data from an external source, such as:




  • an API

  • a database

  • a server

  • a backend service



In other words:

Data fetching is how your React app communicates with the outside world to get dynamic information.

If React only used built-in data, every app would feel static and useless.







🤔 Why Not Just Hard-Code the Data Inside the React App?



Technically, we "could" hard-code the data, but that only works for small apps… small as in 'your never completing untitled project' small, not "I actually need this to work tomorrow" small :).



Here’s why real apps must fetch data:





1. Data changes frequently



User details, comments, product prices, weather updates — these constantly change. You can’t update your app manually every time.





2. Shared data comes from a backend



React apps connect to APIs that store and manage the real data.





3. Better performance & scalability



Instead of shipping massive data with your frontend bundle, you only fetch what you need.





4. Security



Sensitive data should NOT be stored inside the frontend code where anyone can inspect it.



Basically:




  • Hard-coded data = toy projects

  • Fetched data = real-world apps







Different Types of Data Fetching Methods in React



There are several ways to get data in React apps:





  1. fetch() API — Built-in browser function


  2. Axios — A popular third-party HTTP client


  3. React Query / TanStack Query — A data management library


  4. SWR — A lightweight data fetching library


  5. GraphQL clients (Apollo, urql) — For GraphQL APIs



But for starters, the most common and straightforward methods are:




  • fetch()

  • axios



And that’s exactly what my Day 5 is about.







Using useEffect for Data Fetching in React



React components re-render many times. If we fetch data directly inside the component, it will run on every render — and that is... well.... That's bad!



So we wrap data fetching inside useEffect:




useEffect(() => {
// fetch data here
}, []);






The [] ensures the fetching happens only once when the component first loads.









What Are fetch() and axios?






Fetch()




  • A built-in JavaScript API.

  • Already available in all modern browsers.

  • Lightweight but sometimes verbose.






Axios




  • A third-party library (you install it: npm i axios).


  • More powerful features like:




    • automatic JSON parsing

    • better error handling

    • request interceptors

    • cancel tokens

    • timeouts








Both help you send requests like:




  • GET (retrieve data)

  • POST (send data)

  • PUT/PATCH (update data)

  • DELETE (remove data)









Fetching Data Using fetch() in React (with useEffect)



Here’s a clean, beginner-friendly example:




import { useEffect, useState } from "react";

export default function App() {
const [users, setUsers] = useState([]);

useEffect(() => {
fetch("https://jsonplaceholder.typicode.com/users")
.then(response => response.json())
.then(data => setUsers(data))
.catch(error => console.error("Error:", error));
}, []);

return (
<div>
<h2>Users List (Fetched with fetch())</h2>
{users.map(user => (
<p key={user.id}>{user.name}</p>
))}
</div>
);
}









Key Features of fetch():




  • Native support

  • Uses Promises

  • Requires manual JSON parsing

  • Error handling can be tricky









Fetching Data Using Axios in React (with useEffect)



First install Axios:




npm install axios






Then use it like this:




import { useEffect, useState } from "react";
import axios from "axios";

export default function App() {
const [posts, setPosts] = useState([]);

useEffect(() => {
axios
.get("https://jsonplaceholder.typicode.com/posts")
.then(res => setPosts(res.data))
.catch(err => console.error(err));
}, []);

return (
<div>
<h2>Posts List (Fetched with Axios)</h2>
{posts.map(post => (
<p key={post.id}>{post.title}</p>
))}
</div>
);
}









Key features of Axios:




  • Automatically parses JSON

  • Cleaner syntax

  • Better error handling

  • Supports request cancellation

  • Allows interceptors (e.g., for attaching tokens)









fetch() vs axios — Which One Should You Use?











































Feature fetch() axios
Built-in Yes Need to install it
JSON parsing Manual Automatic
Error handling Basic Robust
Request cancellation Hard Easy
Interceptors No Yes
Syntax More verbose Clean and concise





When to Use Which?



Use fetch() if you want:




  • zero dependencies

  • native browser support

  • a simple GET request



Use axios if you want:




  • cleaner, shorter code

  • automatic JSON conversion

  • robust error handling

  • interceptors for authentication

  • more complex API interaction



Both are great — but Axios tends to be easier and more pleasant for real-world apps.









Conclusion



Day 5 was all about understanding how React really talks to APIs.

Learning data fetching sets the foundation for advanced topics like caching, state management, and React Query.

Tomorrow, the journey continues.



Happy coding!

CTI Threat Relationship Graph2 Knoten / 1 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
SOC Incident Playbook: Remote Code Execution (RCE) Defense
title: Detect Exploitation - Day 5 of #100DaysOfCode — Fetching Data in React (useEffect + fetch + axios)
id: a87b57de-ead3-4be4-b97e-e9c91c50b812
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-24
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-24"
        description = "YARA Signature for "
    strings:
        $str = "Day 5 of #100DaysOfCode — Fetc" ascii wide
    condition:
        any of them
}
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich Day 5 of #100DaysOfCode — Fetching Data .... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Day 5 of #100DaysOfCode — Fetching Data in React (useEffect + fetch + axios)

Thematisch verwandte Begriffe: 100DaysOfCode, Fetching, Data, React · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-97056 | SigNoz versions from v0.98.0 up to (but not including) v0.143.0, when co…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick