Back to Templates
React Router Hybrid Rendering Template
React Router v7 hybrid rendering with SSR, CSR, SSG, Streaming, Cloud Functions, and Edge Functions.
| Framework | React Router |
| Use Case | Starter |
EdgeOne Pages React Router Starter
A comprehensive React Router v7 starter template for EdgeOne Pages, showcasing various rendering modes and full-stack capabilities.
๐ Features
- Server-Side Rendering (SSR) - Real-time server-side rendering
- Client-Side Rendering (CSR) - Dynamic rendering in the browser
- Streaming SSR - Progressive rendering with deferred data loading
- Static Site Generation (SSG) - Static generation at build time
- Pages Functions - Edge and Node.js serverless functions
- Modern UI - Beautiful interface with Tailwind CSS
๐ ๏ธ Tech Stack
- React Router v7 - Full-stack React framework
- TypeScript - Type safety
- Tailwind CSS - Styling framework
- Lucide React - Icon library
- Vite - Build tool
๐ฆ Installation
# Clone the project
git clone <repository-url>
cd react-router-v7-demo
# Install dependencies
npm install
# Start development server
edgeone pages dev
# deploy the project
edgeone pages deploy
Learn more about EdgeOne CLI.
๐ฏ Pages Overview
Home (/)
Displays project overview and entry points to various feature modules.
SSR (/ssr)
Demonstrates server-side rendering:
- Re-renders on the server for each request
- Real-time data fetching
- SEO friendly
- Suitable for dynamic content
CSR (/csr)
Demonstrates client-side rendering:
- All rendering happens in the browser
- Data fetching after JavaScript loads
- Rich interactive experiences
- Reduced server load
- Suitable for interactive applications
Streaming (/streaming)
Demonstrates streaming SSR:
- Progressive rendering with deferred data loading
- HTML shell sent immediately with fast data
- Slow data streams in as it becomes available
- Optimal user experience with Suspense boundaries
- Works for both SSR and client-side navigation
Pre-render (/prerender)
Demonstrates static site generation:
- Pre-generates pages at build time
- Fastest loading speed
- CDN friendly
- Suitable for static content
Pages Functions (/pages-functions)
Demonstrates EdgeOne Pages Functions:
- Edge Functions - Ultra-low latency on 3200+ global edge nodes
- Node Functions - Full Node.js runtime with npm ecosystem
- Serverless architecture with auto-scaling
- Perfect for APIs and backend logic
๐ Project Structure
app/
โโโ components/ # Components
โ โโโ ui/ # UI components
โ โโโ layout/ # Layout components
โ โโโ Header.tsx # Header navigation
โ โโโ Hero.tsx # Home hero section
โ โโโ Features.tsx # Features showcase
โ โโโ FeatureCard.tsx # Feature card
โโโ lib/ # Utility functions
โ โโโ utils.ts # Common utilities
โโโ routes/ # Route pages
โ โโโ home.tsx # Home page
โ โโโ ssr.tsx # SSR demo
โ โโโ csr.tsx # CSR demo
โ โโโ streaming.tsx # Streaming SSR demo
โ โโโ prerender.tsx # Pre-render demo
โ โโโ pages-functions.tsx # Pages Functions demo
โโโ app.css # Global styles
โโโ root.tsx # Root component
โโโ routes.ts # Route configuration
edge-functions/ # Edge runtime functions
node-functions/ # Node.js runtime functions
public/ # Static assets
๐ Learning Resources
- EdgeOne Pages Official Documentation
- React Router v7 Official Documentation
- React Router v7 GitHub
- Vite Documentation
- Tailwind CSS Documentation
๐ค Contributing
Issues and Pull Requests are welcome!
๐ License
MIT License