Frontend Routing

Frontend Routing

Teaches a coding agent to implement client-side routing in React Router, Vue Router and Angular Router, with lazy loading, protected routes and query parameter handling.

Skill files7 files

references/

templates/

SKILL.md90 lines
1
---
2
name: frontend-routing
3
description: >
4
Implement client-side routing using React Router, Vue Router, and Angular
5
Router. Use when building multi-page applications with navigation and route
6
protection.
7
---
8
9
# Frontend Routing
10
11
## Table of Contents
12
13
- [Overview](#overview)
14
- [When to Use](#when-to-use)
15
- [Quick Start](#quick-start)
16
- [Reference Guides](#reference-guides)
17
- [Best Practices](#best-practices)
18
19
## Overview
20
21
Implement client-side routing with navigation, lazy loading, protected routes, and state management for multi-page single-page applications.
22
23
## When to Use
24
25
- Multi-page navigation
26
- URL-based state management
27
- Protected/guarded routes
28
- Lazy loading of components
29
- Query parameter handling
30
31
## Quick Start
32
33
Minimal working example:
34
35
```typescript
36
// App.tsx
37
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
38
import { Layout } from './components/Layout';
39
import { Home } from './pages/Home';
40
import { NotFound } from './pages/NotFound';
41
import { useAuth } from './hooks/useAuth';
42
import React from 'react';
43
44
// Lazy loaded components
45
const Dashboard = React.lazy(() => import('./pages/Dashboard'));
46
const UserProfile = React.lazy(() => import('./pages/UserProfile'));
47
const Settings = React.lazy(() => import('./pages/Settings'));
48
49
// Protected route wrapper
50
const ProtectedRoute: React.FC<{ children: React.ReactNode }> = ({ children }) => {
51
const { isAuthenticated } = useAuth();
52
53
if (!isAuthenticated) {
54
return <Navigate to="/login" replace />;
55
}
56
57
return <>{children}</>;
58
};
59
60
export const App: React.FC = () => {
61
// ... (see reference guides for full implementation)
62
```
63
64
## Reference Guides
65
66
Detailed implementations in the `references/` directory:
67
68
| Guide | Contents |
69
|---|---|
70
| [React Router v6](references/react-router-v6.md) | React Router v6 |
71
| [Vue Router 4](references/vue-router-4.md) | Vue Router 4 |
72
| [Angular Routing](references/angular-routing.md) | Angular Routing |
73
| [Query Parameter Handling](references/query-parameter-handling.md) | Query Parameter Handling |
74
| [Route Transition Effects](references/route-transition-effects.md) | Route Transition Effects |
75
76
## Best Practices
77
78
### ✅ DO
79
80
- Follow established patterns and conventions
81
- Write clean, maintainable code
82
- Add appropriate documentation
83
- Test thoroughly before deploying
84
85
### ❌ DON'T
86
87
- Skip testing or validation
88
- Ignore error handling
89
- Hard-code configuration values
90

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…