• Product Introduction
  • Quick Start
    • Agent Development
    • Importing a Git Repository
    • Starting From a Template
    • Direct Upload
    • Start with AI
  • Framework Guide
    • Agent
    • Frontends
      • Vite
      • React
      • Vue
      • Hugo
      • Other Frameworks
    • Backends
    • Full-stack
      • Next.js
      • Nuxt
      • Astro
      • React Router
      • SvelteKit
      • TanStack Start
      • Vike
    • Custom 404 Page
  • Project Guide
    • Project Management
    • edgeone.json
    • Configuring Cache
    • Building Output Configuration
    • Error Codes
  • Build Guide
  • Deployment Guide
    • Overview
    • Create Deploys
    • Manage Deploys
    • Deploy Button
    • Using Github Actions
    • Using Gitlab CI/CD
    • Using CNB Plugin
    • Using IDE PlugIn
    • Using CodeBuddy IDE
  • Domain Management
    • Overview
    • Custom Domain
    • HTTPS Configuration
      • Overview
      • Apply for Free Certificate
      • Using Managed SSL Certificate
    • Configure DNS CNAME Record
  • Observability
    • Overview
    • Metric Analysis
    • Log Analysis
  • Functions
    • Overview
    • Edge Functions
    • Cloud Functions
      • Overview
      • Node.js
      • Python
      • Go
  • Agents
    • Overview
    • Quick Start
    • Conversation Storage
    • Observability
    • Sandbox Tool
      • Overview
      • Using the Agent Framework
      • Sandbox Atomic API
      • Network Search Tool
    • Agent Authentication
  • Models
    • Overview
    • Models and Vendors
      • Overview
      • Using Vendor Keys
        • OpenAI
        • Anthropic
        • Google AI Studio
        • DeepSeek
        • MiniMax
        • Hunyuan
        • Zhipu
        • MoonShot AI
    • FAQs
  • Storage
    • Overview
    • KV
    • Blob
  • Middleware
  • AI Tools
    • MCP
    • Skills
    • Plugin
  • Copilot
    • Overview
    • Quick Start
  • API Token
  • EdgeOne CLI
  • Message Notification
  • Integration Guide
    • AI
      • Dialogue Large Models Integration
      • Large Models for Images Integration
    • Database
      • Supabase Integration
      • Pages KV Integration
    • Ecommerce
      • Shopify Integration
      • WooCommerce Integration
    • Payment
      • Stripe Integration
      • Integrating Paddle
    • CMS
      • WordPress Integration
      • Contentful Integration
      • Sanity Integration
      • Payload Integration
    • Authentication
      • Supabase Integration
      • Clerk Integration
  • Best Practices
    • AI Dialogue Deployment: Deploy Project with One Sentence Using Skill
    • Using General Large Model to Quickly Build AI Application
    • Use the DeepSeek model to quickly build a conversational AI site
    • Building an Ecommerce Platform with Shopify
    • Building a SaaS Site Using Supabase and Stripe
    • Building a Company Brand Site Quickly
    • How to Quickly Build a Blog Site
  • Migration Guides
    • Migrating from Vercel to EdgeOne Pages
    • Migrating from Cloudflare Pages to EdgeOne Pages
    • Migrating from Netlify to EdgeOne Pages
  • Troubleshooting
  • FAQs
  • Limits
  • Pricing
  • Contact Us
  • Release Notes

React Router

React Router is the most popular routing solution in the React ecosystem and has evolved into a full-stack framework. React Router 7 is built on Vite, providing a modern development experience and supporting multiple rendering modes such as server-side rendering and static generation, enabling you to build high-performance full-stack Web applications.
Note:
Currently, Makers supports React Router version 7+ and full-stack deployment.

Core Features

Full-stack framework: Upgraded from a simple routing library to a full-stack framework, supporting integration of front-end and back-end development.
Multiple rendering modes: Supports SSR (server-side rendering), SSG (static generation), SPA (single-page application), and other rendering modes, flexibly adapting to different scenarios.
Nested routes: A powerful nested routing system that supports layout nesting and parallel data loading.
Data loading: Built-in data loading mechanism (loader) and data modification (action) to simplify data access and form processing.
Type-safe routing: Native TypeScript support with full type inference and route type safety.
File-based routing: Supports routing agreement based on file system to simplify routing configuration.

Quick Start

Start deploying your React Router project on EdgeOne Makers:
Import a React Router project from a Git repository.
Select a React Router template from the Makers template library.
Use the @edgeone/react-router framework adapter to deploy a local project.
To understand the deployment performance of React Router on Makers, click the example template below:


Makers Support for React Router

The table below lists the key React Router features currently supported by Makers. The platform will also support more features as soon as possible, but experimental features may not be fully stable yet.
React Router Features
Support Status
Server-Side Rendering (SSR)
Static Site Generation (SSG)
Single Page Application (SPA)
Route Loaders
Route Actions
Nested Routes
File-based Routing
Streaming
Experimental features
Partially supported

Deploying a React Router Project on Makers

@edgeone/react-router is a Vite plugin that automatically adapts React Router v7 applications to the Makers platform, and it can work with Makers' scaffolding tools to deploy local React Router.
The project is packaged and deployed to the Makers platform. The main features of @edgeone/react-router are as follows:
Automatic adaptation: Converts React Router v7 applications into a format executable by the Makers platform.
Multi-mode support: Supports SSR, SPA, pre-rendering, and other rendering modes.
Resource optimization: automatic processing and packaging of static resources.
To deploy a React Router project on Makers, refer to the following steps.

1. Installing an Adapter

npm install @edgeone/react-router

2. Configure Vite

In vite.config.ts, introduce and use edgeoneAdapter:
import { reactRouter } from "@react-router/dev/vite";
import { defineConfig } from "vite";
import { edgeoneAdapter } from "@edgeone/react-router";

export default defineConfig({
plugins: [
reactRouter(),
edgeoneAdapter() // add EdgeOne adapter
],
});


3. Deploying a Project

Git Connection Deployment
After seamless integration with the adapter, you can submit the project to platforms such as GitHub and GitLab, and use our import Git repository.
CLI Deployment
You can also install the Makers scaffolding tool. For detailed installation and usage instructions, see EdgeOne CLI. After configuration, use the `edgeone makers deploy` command to deploy the project. During deployment, the CLI first automatically builds the project, then uploads and publishes the build artifacts.
Note:
EdgeOne CLI version requirement ≥ 1.2.4. Please first check version before deployment to avoid deployment failure.

Server-Side Rendering (SSR)

Server-side rendering allows you to render webpages on servers dynamically. Every time users initiate requests, the server retrieves data and generates HTML in real time, improving SEO and the first-screen loading experience.
In React Router, data can be obtained through the loader function on the server:
// routes/post.tsx
import type { Route } from "./+types/post";

export async function loader({ params }: Route.LoaderArgs) {
const post = await fetchPost(params.id);
return { post };
}

export default function Post({ loaderData }: Route.ComponentProps) {
return (
<article>
<h1>{loaderData.post.title}</h1>
<div>{loaderData.post.content}</div>
</article>
);
}
Default build settings are as follows:
Build command: npm run build
Output directory: build

Static Site Generation (SSG)

React Router supports pre-rendering static pages during build. By configuring the prerender option, you can generate specified routes as static HTML.
Configure in react-router.config.ts:
import type { Config } from "@react-router/dev/config";

export default {
async prerender() {
return [
"/",
"/about",
"/blog/post-1",
"/blog/post-2",
];
},
} satisfies Config;
can also dynamically generate pre-rendered routes:
export default {
async prerender() {
const posts = await fetchAllPosts();
return [
"/",
...posts.map(post => `/blog/${post.slug}`)
];
},
} satisfies Config;
Default build settings are as follows:
Build command: npm run build
Output directory: build/client

Single-Page Application (SPA) Mode

If server-side functionality is not required, you can configure React Router in pure SPA mode. Set in react-router.config.ts:
import type { Config } from "@react-router/dev/config";

export default {
ssr: false,
} satisfies Config;
Default build settings are as follows:
Build command: npm run build
Output directory: build/client

Streaming Rendering

React Router supports streaming rendering through React 18's Suspense. Page content can be gradually transmitted from the server to the client without waiting for all data to load.
import { Suspense } from "react";
import { Await } from "react-router";

export async function loader() {
// Return a Promise without waiting
const postsPromise = fetchPosts();
const weatherPromise = fetchWeather();
return {
posts: postsPromise,
weather: weatherPromise,
};
}

export default function Dashboard({ loaderData }) {
return (
<div>
<Suspense fallback={<p>Loading posts...</p>}>
<Await resolve={loaderData.posts}>
{(posts) => <PostList posts={posts} />}
</Await>
</Suspense>
<Suspense fallback={<p>Loading weather...</p>}>
<Await resolve={loaderData.weather}>
{(weather) => <Weather data={weather} />}
</Await>
</Suspense>
</div>
);
}

More Resources

ai-agent
You can ask me like
What types of applications can I deploy?