Skip to content
Proyek

KevinVandy/react-data-fetching

Lihat di GitHub

Tentang

Aplikasi yang sama dibuat beberapa kali dengan framework React yang berbeda agar dapat dibandingkan secara setara.

Pengembangan web dan aplikasi

Cara angka ini diukur

Pertumbuhan bintang terukur

dalam 24 jam
0
dalam 7 hari
0
dalam 15 hari
0
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli

React Data Fetching

This repository demonstrates the four main data-fetching strategies in modern React applications: Client-Side Rendering (CSR), Static Site Generation (SSG), Server-Side Rendering (SSR), and Streaming with React Server Components. Each approach is implemented across multiple frameworks to show real-world patterns and trade-offs.

Table of Contents

Client-Side Rendering (CSR/SPAs)

Static Site Generation (SSG)

Server-Side Rendering (SSR)

HTML Streaming (RSC / Astro Server Islands)

Understanding Data-Fetching Strategies

Each directory contains a README explaining the core concepts, pros and cons, and use cases:

  • apps/1-csr/ - Client-Side Rendering: JavaScript fetches data in the browser
  • apps/2-ssg/ - Static Site Generation: Pages built at build time with data pre-fetched
  • apps/3-ssr/ - Server-Side Rendering: HTML generated on server per request
  • apps/4-streaming/ - Streaming: Progressive page delivery with React Server Components

Frameworks Covered

This repository explores data fetching across multiple meta-frameworks and libraries:

  • React Router - Client-side and server-side routing
  • Next.js - Full-stack React framework with SSG, SSR, and RSC
  • Astro - Multi-framework static site generator with server rendering
  • TanStack Router - Type-safe routing with built-in data loading
  • TanStack Start - Full-stack React framework built on TanStack Router
  • SvelteKit - bonus Full-stack Svelte framework for comparison

Getting Started

  1. Install dependencies: pnpm install
  2. Start the backend: pnpm serve (runs json-server on port 3300)
  3. Run any example app using the commands listed above
  4. Each app fetches data from the same API to demonstrate different approaches

The examples progress from basic patterns to more advanced implementations, showing how each strategy evolves with different tools and frameworks. TanStack Query (React Query) is heavily featured throughout, demonstrating how this powerful data-fetching library integrates with various meta-frameworks - from pure client-side apps to server-rendered applications with hydration, and even alongside React Server Components for optimal user experiences.

Jelajahi proyek terkait

Memuat…