File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed
Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 2929- [ Live Components] ( resources/live-components.md ) - WebSocket components
3030- [ Live Upload] ( resources/live-upload.md ) - Chunked upload via Live Components
3131- [ External Plugins] ( resources/plugins-external.md ) - Plugin development
32+ - [ Routing (React Router v7)] ( reference/routing.md ) - Frontend routing setup
3233
3334## Patterns & Rules
3435
Original file line number Diff line number Diff line change 1+ # Routing (React Router v7)
2+
3+ FluxStack uses ** React Router v7** via the ` react-router ` package for web routing.
4+
5+ ## Where It Lives
6+
7+ - Router provider: ` app/client/src/main.tsx `
8+ - Routes and pages: ` app/client/src/App.tsx `
9+ - Pages: ` app/client/src/pages/* `
10+ - Shared layout: ` app/client/src/components/AppLayout.tsx `
11+
12+ ## Why ` react-router ` (not ` react-router-dom ` )
13+
14+ In v7, the React Router team recommends using the core ` react-router ` package
15+ directly for web apps. The ` react-router-dom ` package remains as a compatibility
16+ re-export for older apps, but new projects should import from ` react-router ` .
17+
18+ ## Example: Adding a New Route
19+
20+ 1 . Create a page in ` app/client/src/pages/MyPage.tsx `
21+ 2 . Add a route in ` app/client/src/App.tsx ` :
22+
23+ ``` tsx
24+ import { MyPage } from ' ./pages/MyPage'
25+
26+ <Route path = " /my-page" element = { <MyPage />} />
27+ ```
28+
29+ 3 . Add a nav link in ` app/client/src/components/AppLayout.tsx `
30+
31+ ## Current Demo Routes
32+
33+ - ` / ` Home
34+ - ` /counter ` Live Counter
35+ - ` /form ` Live Form
36+ - ` /upload ` Live Upload
37+ - ` /chat ` Live Chat
38+ - ` /api-test ` Eden Treaty API Test
39+
Original file line number Diff line number Diff line change @@ -86,6 +86,11 @@ Default routes in the demo app:
8686- ` /upload ` Live Upload
8787- ` /api-test ` Eden Treaty API Test
8888
89+ ### 🧭 Router Package
90+
91+ This project now uses ** React Router v7** via the ` react-router ` package (recommended by the v7 docs).
92+ If you are upgrading from an older setup that used ` react-router-dom ` , update imports to ` react-router ` .
93+
8994### Alternative Installation
9095
9196``` bash
You can’t perform that action at this time.
0 commit comments