File contents Frontend Routing
Table of Contents
Overview
Implement client-side routing with navigation, lazy loading, protected routes, and state management for multi-page single-page applications.
When to Use
Multi-page navigation
URL-based state management
Protected/guarded routes
Lazy loading of components
Query parameter handling
Quick Start
Minimal working example:
// App.tsx
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
import { Layout } from './components/Layout';
import { Home } from './pages/Home';
import { NotFound } from './pages/NotFound';
import { useAuth } from './hooks/useAuth';
import React from 'react';
// Lazy loaded components
const Dashboard = React.lazy(() => import('./pages/Dashboard'));
const UserProfile = React.lazy(() => import('./pages/UserProfile'));
const Settings = React.lazy(() => import('./pages/Settings'));
// Protected route wrapper
const ProtectedRoute: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const { isAuthenticated } = useAuth();
if (!isAuthenticated) {
return <Navigate to="/login" replace />;
}
return <>{children}</>;
};
export const App: React.FC = () => {
// ... (see reference guides for full implementation)
Reference Guides
Detailed implementations in the references/ directory:
Guide
Contents
React Router v6
React Router v6
Vue Router 4
Vue Router 4
Angular Routing
Angular Routing
Query Parameter Handling
Query Parameter Handling
Route Transition Effects
Route Transition Effects
Best Practices
✅ DO
Follow established patterns and conventions
Write clean, maintainable code
Add appropriate documentation
Test thoroughly before deploying
❌ DON'T
Skip testing or validation
Ignore error handling
Hard-code configuration values
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1 --- 2 name: aj-geddes-useful-ai-prompts-frontend-routing 3 description: Frontend Routing 4 --- 5 6 # Frontend Routing 7 8 ## Table of Contents 9 10 - [Overview](#overview) 11 - [When to Use](#when-to-use) 12 - [Quick Start](#quick-start) 13 - [Reference Guides](#reference-guides) 14 - [Best Practices](#best-practices) 15 16 ## Overview 17 18 Implement client-side routing with navigation, lazy loading, protected routes, and state management for multi-page single-page applications. 19 20 ## When to Use 21 22 - Multi-page navigation 23 - URL-based state management 24 - Protected/guarded routes 25 - Lazy loading of components 26 - Query parameter handling 27 28 ## Quick Start 29 30 Minimal working example: 31 32 ```typescript 33 // App.tsx 34 import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'; 35 import { Layout } from './components/Layout'; 36 import { Home } from './pages/Home'; 37 import { NotFound } from './pages/NotFound'; 38 import { useAuth } from './hooks/useAuth'; 39 import React from 'react'; 40 41 // Lazy loaded components 42 const Dashboard = React.lazy(() => import('./pages/Dashboard')); 43 const UserProfile = React.lazy(() => import('./pages/UserProfile')); 44 const Settings = React.lazy(() => import('./pages/Settings')); 45 46 // Protected route wrapper 47 const ProtectedRoute: React.FC<{ children: React.ReactNode }> = ({ children }) => { 48 const { isAuthenticated } = useAuth(); 49 50 if (!isAuthenticated) { 51 return <Navigate to="/login" replace />; 52 } 53 54 return <>{children}</>; 55 }; 56 57 export const App: React.FC = () => { 58 // ... (see reference guides for full implementation) 59 ``` 60 61 ## Reference Guides 62 63 Detailed implementations in the `references/` directory: 64 65 | Guide | Contents | 66 |---|---| 67 | [React Router v6](references/react-router-v6.md) | React Router v6 | 68 | [Vue Router 4](references/vue-router-4.md) | Vue Router 4 | 69 | [Angular Routing](references/angular-routing.md) | Angular Routing | 70 | [Query Parameter Handling](references/query-parameter-handling.md) | Query Parameter Handling | 71 | [Route Transition Effects](references/route-transition-effects.md) | Route Transition Effects | 72 73 ## Best Practices 74 75 ### ✅ DO 76 77 - Follow established patterns and conventions 78 - Write clean, maintainable code 79 - Add appropriate documentation 80 - Test thoroughly before deploying 81 82 ### ❌ DON'T 83 84 - Skip testing or validation 85 - Ignore error handling 86 - Hard-code configuration values 87 88 --- 89 > Converted and distributed by [TomeVault](https://tomevault.io/claim/aj-geddes) — claim your Tome and manage your conversions. 90 <!-- tomevault:4.0:skill_md:2026-04-11 -->
tomevault-io/skills-registry/tree/main/aj-geddes--useful-ai-prompts--frontend-routing commit c2e6659659
Frequently asked questions How do I install the Aj Geddes Useful AI Prompts Frontend Routing skill? Run npx skillmds@latest add tomevault-io/aj-geddes-useful-ai-prompts-frontend-routing in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Aj Geddes Useful AI Prompts Frontend Routing skill do? Frontend Routing It is listed under Web & Frontend on SkillMD.
Is Aj Geddes Useful AI Prompts Frontend Routing safe to use? This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Aj Geddes Useful AI Prompts Frontend Routing? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Aj Geddes Useful AI Prompts Frontend Routing free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published Aj Geddes Useful AI Prompts Frontend Routing? tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.