https://github.com/hammadhttps/react-router
https://github.com/hammadhttps/react-router
animation-css concepts demonstration framer-motion lucide-react navigation react-router react-router-v7 reactjs router-dom routing
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hammadhttps/react-router
- Owner: hammadhttps
- Created: 2025-07-19T21:37:45.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-07-20T19:02:21.000Z (5 months ago)
- Last Synced: 2025-07-20T20:31:49.391Z (5 months ago)
- Topics: animation-css, concepts, demonstration, framer-motion, lucide-react, navigation, react-router, react-router-v7, reactjs, router-dom, routing
- Language: JavaScript
- Homepage:
- Size: 106 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React Router 7 Concepts Demo - TechCorp
đ§ React Router 7 Concepts Demo
A comprehensive demonstration of React Router 7 features and routing concepts
Built with TechCorp theme for visual appeal




## ⨠Overview
This project is a **comprehensive demonstration of React Router 7 concepts and features**. Using a modern TechCorp theme for visual appeal, it showcases all the essential routing patterns, navigation techniques, and advanced features that React Router 7 offers.
**Primary Purpose**: Educational demonstration of React Router 7 capabilities
**Secondary Purpose**: Modern UI/UX implementation for enhanced learning experience
## đ§ React Router 7 Concepts Demonstrated
### **Core Routing Features**
- **Basic Routing**: Simple route definitions and navigation
- **Nested Routes**: Complex route hierarchies with layouts
- **Dynamic Routes**: URL parameters and dynamic segments
- **Route Loaders**: Data fetching with loader functions
- **Error Boundaries**: Route-level error handling
- **Programmatic Navigation**: useNavigate hook implementation
- **Active Links**: NavLink with active state styling
- **Route Layouts**: Shared layouts and outlet components
### **Advanced Routing Patterns**
- **Layout Routes**: RootLayout, ContactLayout, JobsLayout
- **Index Routes**: Default child routes
- **Catch-All Routes**: 404 handling with wildcard routes
- **Route Protection**: Error boundaries and fallbacks
- **Data Loading**: Async data fetching with loaders
- **Route Transitions**: Smooth navigation with animations
### **Navigation Concepts**
- **Declarative Navigation**: Link and NavLink components
- **Imperative Navigation**: useNavigate for programmatic routing
- **Route State**: Passing state through navigation
- **URL Parameters**: Dynamic route segments (/jobs/:id)
- **Query Parameters**: Search params handling
- **Navigation Guards**: Route-level protection patterns
## đ¯ UI/UX Features (Supporting the Demo)
### đ¨ **Design Excellence**
- **Modern Design System**: Comprehensive color palette, typography scale, and spacing system
- **Responsive Layout**: Mobile-first design that scales beautifully across all devices
- **Glass Morphism**: Contemporary backdrop blur effects and translucent elements
- **Micro-interactions**: Delightful hover states and smooth transitions
- **Professional Typography**: Inter font family with optimized readability
### ⥠**Performance & Animation**
- **Framer Motion**: Smooth page transitions and engaging micro-animations
- **Optimized Loading**: Fast initial load times with efficient code splitting
- **Interactive Elements**: Responsive buttons, cards, and navigation components
- **Smooth Scrolling**: Enhanced user experience with fluid page interactions
### đ§ **Navigation & Routing**
- **React Router 7 Demo**: Complete showcase of routing capabilities
- **Active States**: Visual feedback for current page navigation
- **Error Boundaries**: Comprehensive error handling with custom error pages
- **404 Handling**: Beautiful not-found page with helpful navigation options
- **Nested Routing**: Contact and Jobs sections with sub-routes
- **Dynamic Routing**: Individual job detail pages with parameters
### đą **Demo Pages & Routing Structure**
#### đ **Home Page** (`/`)
- **Route**: Index route demonstration
- **Features**: Hero section, feature highlights, statistics
- **Routing**: Base route with navigation to all sections
#### đī¸ **Products Page** (`/product`)
- **Route**: Simple route demonstration
- **Features**: Product showcase with detailed information
- **Routing**: Direct navigation from main menu
#### âšī¸ **About Page** (`/about`)
- **Route**: Static route with rich content
- **Features**: Company information and timeline
- **Routing**: Standard navigation pattern
#### đ **Contact Section** (`/contact`)
- **Route**: Layout route with nested children
- **Sub-routes**:
- `/contact/info` - Contact information display
- `/contact/form` - Interactive contact form
- **Features**: Demonstrates nested routing and layouts
#### đŧ **Jobs Section** (`/jobs`)
- **Route**: Complex nested routing with data loading
- **Sub-routes**:
- `/jobs` - Job listings with loader function
- `/jobs/:id` - Dynamic job details with parameters
- **Features**: Data fetching, error handling, dynamic routes
#### đĢ **Error Handling**
- **404 Page**: Catch-all route (`*`) for unmatched URLs
- **Error Boundaries**: Route-level error handling
- **Loading States**: Demonstrates async route transitions
## đ ī¸ Technology Stack
### **Core Routing**
- **Frontend Framework**: React 19.1.0
- **Routing Library**: React Router 7.7.0 (Primary Focus)
### **Supporting Technologies**
- **Animations**: Framer Motion 12.23.6
- **Icons**: Lucide React 0.525.0
- **Build Tool**: Vite 7.0.4
- **Styling**: Custom CSS with modern design system
- **Development**: ESLint for code quality
## đī¸ Routing Structure
```
/ (RootLayout)
âââ / (Home - Index Route)
âââ /product (Products Page)
âââ /about (About Page)
âââ /contact (ContactLayout)
â âââ /contact/info (Contact Info)
â âââ /contact/form (Contact Form)
âââ /jobs (JobsLayout)
â âââ /jobs (Jobs List - with loader)
â âââ /jobs/:id (Job Details - with loader & params)
âââ /* (404 Not Found - Catch-all)
```
## đ Getting Started
### Prerequisites
- Node.js (version 18 or higher)
- npm or yarn package manager
### Installation
1. **Clone the React Router demo**
```bash
git clone
cd react-router-techcorp
```
2. **Install dependencies**
```bash
npm install
```
3. **Start the development server**
```bash
npm run dev
```
4. **Open your browser**
Navigate to `http://localhost:5173` to view the application
5. **Explore the routing concepts**
- Navigate between pages to see route transitions
- Visit `/contact/info` and `/contact/form` for nested routes
- Check `/jobs/1` for dynamic routing
- Try invalid URLs to see 404 handling
### Available Scripts
- `npm run dev` - Start development server
- `npm run build` - Build for production
- `npm run preview` - Preview production build
- `npm run lint` - Run ESLint for code quality
## đ Project Structure
### **Routing Architecture**
```
src/
âââ Layout/ # đ§ Route Layout Components
â âââ RootLayout.jsx # Main app layout with Navbar + Outlet
â âââ ContactLayout.jsx # Contact section layout (nested routes)
â âââ JobsLayout.jsx # Jobs section layout (nested routes)
âââ pages/ # đ Route Components (Main Pages)
â âââ Home.jsx # Index route (/)
â âââ Product.jsx # Products route (/product)
â âââ About.jsx # About route (/about)
â âââ Contact.jsx # Contact parent route (/contact)
â âââ Jobs.jsx # Jobs list route (/jobs) with loader
âââ components/ # đ§Š Route-specific Components
â âââ Navbar.jsx # Navigation with NavLink examples
â âââ Info.jsx # Contact info route (/contact/info)
â âââ Form.jsx # Contact form route (/contact/form)
â âââ JobsDetails.jsx # Dynamic job route (/jobs/:id) with loader
â âââ NotFound.jsx # 404 catch-all route (*)
â âââ ErrorPage.jsx # Error boundary component
âââ assets/ # đ Mock Data for Loaders
â âââ data.json # Job data for loader demonstrations
âââ App.jsx # đ Router Configuration & Route Definitions
âââ main.jsx # Application entry point
âââ index.css # Global styles and design system
```
## đ§ Key React Router 7 Concepts Explained
### **1. Route Configuration**
```jsx
// App.jsx - Declarative route configuration
const router = createBrowserRouter(
createRoutesFromElements(
} errorElement={}>
} />
}>
} />
} />
}
loader={job_Details_Loader}
/>
)
);
```
### **2. Layout Components with Outlet**
```jsx
// RootLayout.jsx - Shared layout pattern
const RootLayout = () => (
{/* Child routes render here */}
);
```
### **3. Data Loading with Loaders**
```jsx
// Jobs.jsx - Route loader for data fetching
export const jobs_Loader = async () => {
const res = await fetch("http://localhost:5000/jobs");
return res.json();
};
```
### **4. Dynamic Routes with Parameters**
```jsx
// JobsDetails.jsx - Accessing route parameters
export const job_Details_Loader = async ({ params }) => {
const { id } = params;
const res = await fetch(`http://localhost:5000/jobs/${id}`);
return res.json();
};
```
### **5. Navigation Patterns**
```jsx
// Navbar.jsx - NavLink with active states
(isActive ? "active" : "")}>
Jobs
;
// Programmatic navigation
const navigate = useNavigate();
navigate("/contact", { replace: true });
```
## đ¨ Design System (Supporting the Demo)
### Color Palette
- **Primary**: Blue gradient (#0ea5e9 to #0284c7)
- **Secondary**: Purple gradient (#d946ef to #c026d3)
- **Neutral**: Comprehensive gray scale
- **Semantic**: Success, warning, and error colors
### Typography
- **Font Family**: Inter (Google Fonts)
- **Scale**: 12 responsive text sizes
- **Weights**: Light (300) to Extra Bold (800)
- **Line Heights**: Optimized for readability
### Spacing System
- **Base Unit**: 8px
- **Scale**: 1x to 24x (8px to 192px)
- **Consistent**: Applied throughout all components
## đ§ React Router Features Demonstrated
### â
**Core Routing Concepts**
- [x] Basic route configuration with createBrowserRouter
- [x] Nested routes and layout components
- [x] Index routes for default children
- [x] Dynamic routes with URL parameters
- [x] Route loaders for data fetching
- [x] Error boundaries and error handling
- [x] 404 handling with catch-all routes
### â
**Navigation Patterns**
- [x] NavLink with active state styling
- [x] Programmatic navigation with useNavigate
- [x] Link components for declarative navigation
- [x] Navigation state and replace options
- [x] Route transitions with animations
### â
**Advanced Features**
- [x] Layout routes with shared components
- [x] Route-specific error boundaries
- [x] Data loading with async loaders
- [x] URL parameter extraction
- [x] Route protection patterns
- [x] Loading states and fallbacks
### â
**Supporting UI/UX**
- [x] Modern design system for visual appeal
- [x] Responsive design for all devices
- [x] Smooth animations and transitions
- [x] Professional content and layouts
- [x] Interactive components and forms
## đ Learning Highlights
### **React Router 7 Mastery**
- Complete route configuration patterns
- Advanced nested routing techniques
- Data loading and error handling strategies
- Navigation patterns and best practices
### **Real-World Application**
- Enterprise-level routing architecture
- Scalable component organization
- Professional error handling
- Performance optimization techniques
### **Modern Development Practices**
- TypeScript-ready component structure
- ESLint configuration for code quality
- Modern JavaScript and React patterns
- Professional project organization
## đą Responsive Design
The application is fully responsive and optimized for:
- **Mobile**: 320px - 768px
- **Tablet**: 768px - 1024px
- **Desktop**: 1024px and above
## đ Animations (Enhanced Learning Experience)
Powered by Framer Motion, the application includes:
- Page transition animations
- Staggered list animations
- Hover and focus micro-interactions
- Loading state animations
- Scroll-triggered animations
## đŽ Potential Extensions
- [ ] Authentication routes and protected routes
- [ ] Search functionality with query parameters
- [ ] Infinite scrolling with route state
- [ ] Modal routes and parallel routing
- [ ] Route-based code splitting
- [ ] Advanced error recovery patterns
## đ¯ Learning Objectives
After exploring this project, you should understand:
- How to configure React Router 7 with modern patterns
- Nested routing and layout component strategies
- Data loading patterns with route loaders
- Error handling and boundary implementation
- Navigation patterns and active state management
- Dynamic routing with URL parameters
- Route organization and scalable architecture
## đ Acknowledgments
- **React Router Team** for the excellent routing library
- **React Team** for the powerful framework
- **Remix Team** for React Router 7 innovations
- **Community** for routing patterns and best practices
---
Learn React Router 7 through hands-on exploration
TechCorp theme provides visual context for routing demonstrations