Ecommerce Developers, Social Media Marketing, AI AutomationShopify & WooCommerce Stores · Performance Marketing · AI-Powered FunnelsEcommerce Developers, Social Media Marketing, AI Automation
12.20.25

React Router Basics: Multi-Page Navigation for a Brochure Website

Published: December 20, 2025
Written by Sumeet Shroff
React Router Basics: Multi-Page Navigation for a Brochure Website
Table of Contents
  1. Introduction to React Router and Brochure Websites
  2. What is React Router?
  3. What is a Brochure Website?
  4. Why Use React Router for Brochure Websites?
  5. Benefits of Multi-Page Navigation in React
  6. Is React Router Suitable for Brochure Websites?
  7. Key Questions Answered
  8. What’s Next?
  9. Further Reading
  10. Setting Up Your React Development Environment
  11. 1. Install Node.js and npm
  12. 2. Create a New React Application
  13. 3. Understand the Project Folder Structure
  14. 4. Run the Development Server
  15. Quick Checklist
  16. Further Reading
  17. Installing and Configuring React Router DOM
  18. 1. Install React Router DOM via npm
  19. 2. Import React Router Components
  20. 3. Wrap Your App with BrowserRouter
  21. 4. Understand the Purpose of BrowserRouter
  22. Micro-Project: Test the Setup
  23. Further Reading
  24. Understanding React Router’s Core Concepts
  25. Routes and Route: Mapping Paths to Pages
  26. Link and NavLink: Navigation Without Reloads
  27. Navigation in a Single Page Application (SPA)
  28. The Role of Switch and Routes (v6+)
  29. Common Pitfalls to Avoid
  30. Checklist: Core React Router Components
  31. Further Reading
  32. Planning the Structure of a Brochure Website
  33. 1. Identify Common Pages
  34. 2. Map Out Navigation and Routing Paths
  35. 3. Visualize Website Structure as a Component Tree
  36. 4. Prepare a Navigation Menu Plan
  37. Mini-Project: Write Down Your Page Plan
  38. What’s Next?
  39. Further Reading
  40. Building Pages and Routing with React Router
  41. 1. Create a Page Component for Each Section
  42. 2. Set Up Routes in Your Main App
  43. 3. Understanding Path Mapping and Route Matching
  44. 4. Testing Navigation Between Pages
  45. Micro-Project: Add a 404 Page
  46. Further Reading
  47. Creating a Navigation Menu with React Router
  48. 1. Implement Navigation with Link and NavLink
  49. 2. Style Active Navigation Links
  50. 3. Integrate Navigation into the Website Layout
  51. 4. Ensure Accessibility and Usability
  52. Checklist: Accessible Navigation
  53. Further Reading
  54. Best Practices and Common Mistakes in React Router Navigation
  55. Best Practices for Route Organization
  56. Common Mistakes and How to Avoid Them
  57. Step-by-Step: Avoiding Common Routing Pitfalls
  58. When to Use Nested Routes
  59. Ensuring SEO-Friendly Navigation
  60. Further Reading
  61. Advanced: Nested Routes and Layout Components
  62. 1. Create a Reusable Layout Component
  63. 2. Implement Nested Routing for Subpages
  64. Micro-Project: Add a Nested Services Menu
  65. 3. Share Navigation and Structure Across Pages
  66. 4. Understand Route Outlet Concepts
  67. Further Reading
  68. Deploying Your React Brochure Website
  69. 1. Build Your React App for Production
  70. 2. Understand Static Hosting Options
  71. 3. Configure Routing for Deployment
  72. For Netlify:
  73. For Vercel:
  74. 4. Troubleshoot Common Deployment Issues
  75. Micro-Project: Try Deploying to Netlify
  76. Further Reading
  77. Conclusion and Next Steps
  78. Common Questions
  79. Next Steps
  80. Further Reading
  81. About Prateeksha Web Design

Introduction to React Router and Brochure Websites

When building a modern website with React, you’ll quickly encounter the need for multi-page navigation. This is especially true for brochure websites—sites designed to showcase a business, product, or service with clear navigation between key pages like Home, About, Services, and Contact. While React is famous for creating single page applications (SPAs), React Router bridges the gap, enabling seamless navigation that feels multi-page, without full page reloads.

In this section, we’ll demystify what React Router is, why it matters for brochure websites, and how multi-page navigation works in React. By the end, you’ll see why React Router is the go-to tool for adding page-like navigation to your React projects.

What is React Router?

React Router is the standard routing library for React. It allows you to define multiple navigation paths ("routes") in your app, each leading to different components (pages) without reloading the entire page. This gives users the experience of navigating a traditional website, while you enjoy the performance and flexibility of a SPA.

React Router works by updating the browser’s URL and rendering the matching component instantly. This is achieved using special components like <BrowserRouter>, <Routes>, <Route>, and <Link>—you’ll meet these soon.

What is a Brochure Website?

A brochure website is a simple, informational site with a handful of pages. Think of a restaurant website with Home, Menu, Gallery, and Contact pages. The focus is on clear navigation, crisp content, and easy access to information—no complex user accounts or dashboards.

Why Use React Router for Brochure Websites?

React Router is ideal for brochure websites for several reasons:

  • Simple navigation setup: Easily map URLs like /about or /contact to React components.
  • Fast transitions: Users move between pages without reloads, making the site feel snappy.
  • SEO-friendly (with extra setup): With additional tools, React Router can support server-side rendering for better search visibility.
  • Component-based structure: Each page is simply a React component, keeping code organized.
Fact React Router is used by thousands of production websites, from simple landing pages to complex web apps.

Benefits of Multi-Page Navigation in React

  • Improved user experience: Navigation is instant, with no flicker or loss of state.
  • Scalable structure: Add more pages without rewriting navigation logic.
  • Reusability: Share layout or navigation components across pages.

Is React Router Suitable for Brochure Websites?

Absolutely! Even if your site is only a few pages, React Router makes navigation simple and future-proof. If you ever expand your site, you won’t need to rethink your entire navigation system.

Key Questions Answered

  • What is React Router and how does it work?
    • It’s a set of components that map URLs to React components, enabling navigation in SPAs.
  • Is React Router suitable for brochure websites?
    • Yes. It’s perfect for simple sites with multiple pages.
  • What are the benefits of using React Router?
    • Fast navigation, organized code, and easy expansion.
Tip Even if you only need 2-3 pages now, setting up React Router early lets you expand your site without headaches later.

What’s Next?

Now that you understand the why and what, let’s roll up our sleeves and set up your React development environment. This will put you in the perfect position to install React Router and start creating your brochure website.

Further Reading


Setting Up Your React Development Environment

Before you can dive into React Router basics, you need a working React project. This section walks you step-by-step through setting up your environment—installing Node.js and npm, creating a new React app, understanding the folder structure, and running your development server. Whether you’re starting a new brochure website or want to follow along with a fresh project, these steps will get you ready.

1. Install Node.js and npm

Node.js is the JavaScript runtime you’ll use to run development tools, and npm (Node Package Manager) comes bundled with it. React and React Router are installed via npm.

To install Node.js and npm:

  1. Go to the official Node.js downloads page.

  2. Download the recommended LTS version for your operating system.

  3. Run the installer and follow the prompts.

  4. Verify the installation by running these commands in your terminal:

    node --version
    npm --version
    

    You should see version numbers for both.

2. Create a New React Application

The easiest way to start a React project is with Create React App—a toolkit that sets up everything you need in seconds.

To create a new React app:

  1. Open your terminal and navigate to the folder where you want your project (e.g., ~/projects).

  2. Run:

    npx create-react-app brochure-website
    

    Replace brochure-website with your preferred project name.

  3. When it finishes, go into your project folder:

    cd brochure-website
    

3. Understand the Project Folder Structure

Here’s an overview of the key folders and files you’ll see:

  • public/: Static files like index.html and images.
  • src/: Source code for your React app (where you’ll spend most of your time).
    • App.js: Main application component.
    • index.js: Entry point that renders the app.
  • package.json: Lists dependencies and scripts.
Warning Don’t modify files in the `public/` folder unless you know what you’re doing—most of your code belongs in `src/`.

4. Run the Development Server

To see your app in action, start the development server:

npm start
  • Your browser should open to http://localhost:3000/ with the default React welcome screen.
  • The app will automatically reload as you make changes.

Quick Checklist

  • Node.js and npm installed
  • New React app created
  • Project structure understood
  • Development server running

You’re now ready to add React Router and transform your site into a real, multi-page brochure website.

Further Reading


Installing and Configuring React Router DOM

With your React project up and running, it’s time to bring in React Router DOM—the package that handles routing in browser-based React apps. This section guides you through installation, importing key components, and configuring your app to support navigation between pages.

1. Install React Router DOM via npm

Run the following command inside your project folder:

npm install react-router-dom@6
  • This installs the latest stable version of React Router DOM (version 6 at the time of writing).
  • The react-router-dom package provides all the core routing components for web apps.
Fact React Router DOM v6 introduces a simplified API and improved performance compared to previous versions.

2. Import React Router Components

To use React Router, you’ll need to import its components into your code. The most important ones for now are:

  • BrowserRouter: Enables routing in your app.
  • Routes and Route: Define which components show up for which paths.

3. Wrap Your App with BrowserRouter

To activate routing, you must wrap your app in a <BrowserRouter> component. This is typically done in your src/index.js or src/main.jsx file, depending on your setup.

Example (src/index.js):

import React from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import App from './App';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
    <BrowserRouter>
      <App />
    </BrowserRouter>
  </React.StrictMode>
);

What does this do?

  • It enables React Router throughout your app.
  • Any routing components (like Routes, Route, Link) inside <App /> will now work.

4. Understand the Purpose of BrowserRouter

BrowserRouter is the core provider that keeps your app’s UI in sync with the browser’s URL. It uses the HTML5 history API—so when you navigate, the URL updates without a page reload.

  • All your Route and Link components must be used inside a BrowserRouter.
  • You only need one BrowserRouter at the root of your app.
Tip If you ever see an error like "useNavigate() may be used only in the context of a ", make sure you've wrapped your app in BrowserRouter.

Micro-Project: Test the Setup

To confirm everything is working:

  1. Open App.js in your src/ folder.

  2. Add this code to try routing basics:

    import { Routes, Route } from 'react-router-dom';
    
    function Home() {
      return <h2>Home Page</h2>;
    }
    function About() {
      return <h2>About Page</h2>;
    }
    
    function App() {
      return (
        <Routes>
          <Route path="/" element={<Home />} />
          <Route path="/about" element={<About />} />
        </Routes>
      );
    }
    
    export default App;
    
  3. Visit http://localhost:3000/ (should show Home Page) and http://localhost:3000/about (should show About Page).

If you see these pages, React Router is working!

Further Reading


Understanding React Router’s Core Concepts

Before you craft a navigation menu or connect real pages, it’s crucial to grasp React Router’s foundational concepts. Let’s break down the essential components—Routes, Route, Link/NavLink, and how navigation works in a React single page application (SPA).

Routes and Route: Mapping Paths to Pages

  • <Routes>: Acts as a container for all your route definitions. Think of it as the “switchboard” that matches the current URL to a particular page/component.
  • <Route>: Defines a single path and the component to show for that path.

Example:

<Routes>
  <Route path="/" element={<Home />} />
  <Route path="/about" element={<About />} />
  <Route path="/services" element={<Services />} />
</Routes>
  • When the URL is /about, the About component is rendered.
  • Each Route can map to any React component—pages, layouts, or even redirects.

Link and NavLink: Navigation Without Reloads

  • <Link to="/about">About</Link>: Renders an anchor tag (<a>) that updates the URL and renders the new page instantly, without a full reload.
  • <NavLink>: Like Link, but adds styling when the link is "active" (matches the current URL)—ideal for navigation menus.

Example:

import { Link, NavLink } from 'react-router-dom';

function Navigation() {
  return (
    <nav>
      <NavLink to="/" end>Home</NavLink> |
      <NavLink to="/about">About</NavLink> |
      <NavLink to="/services">Services</NavLink> |
      <NavLink to="/contact">Contact</NavLink>
    </nav>
  );
}
  • NavLink automatically applies an active class to the current page link.

Navigation in a Single Page Application (SPA)

React Router enables true SPA behavior:

  • No full page reloads. Only the components change, not the browser page.
  • Preserves app state. Navigating between pages doesn’t lose component state or scroll position (unless you reset them intentionally).
  • Faster experience. Since only part of the page updates, navigation feels instant.

The Role of Switch and Routes (v6+)

If you’ve seen older React Router tutorials, you might notice the Switch component. In React Router v6, Switch is replaced by Routes, which is more flexible and intuitive. Always use Routes with the latest version.

Warning Don’t mix up `Switch` and `Routes`—they are not interchangeable. Use `Routes` for React Router v6 and above.

Common Pitfalls to Avoid

  • Forgetting to wrap your app in BrowserRouter.
  • Using Switch with v6+ (it won’t work!).
  • Not using element={<Component />} in Route (v6+ syntax).
  • Misusing Link: using <a href> causes a full reload, while <Link to> is SPA-friendly.

Checklist: Core React Router Components

  • <BrowserRouter> — Root provider
  • <Routes> — Container for your routes
  • <Route> — Maps URL to page/component
  • <Link> and <NavLink> — SPA navigation

Further Reading


Planning the Structure of a Brochure Website

Before jumping into code, a little planning goes a long way. Let’s lay out the typical structure of a brochure website, map out which pages you’ll need, and design a navigation menu that makes sense for visitors.

1. Identify Common Pages

Most brochure websites have:

  • Home: Welcome page
  • About: Company or individual background
  • Services/Products: What you offer
  • Contact: How visitors can reach you
  • (Optional) Gallery, Testimonials, FAQ, etc.

Example Page List:

  • / — Home
  • /about — About Us
  • /services — Our Services
  • /contact — Contact

2. Map Out Navigation and Routing Paths

For each page, decide on the URL path and which React component will represent it.

PathPage Component
/Home
/aboutAbout
/servicesServices
/contactContact

3. Visualize Website Structure as a Component Tree

A simple React component tree for a brochure site might look like:

App
├── NavigationMenu
├── Routes
│   ├── Home
│   ├── About
│   ├── Services
│   └── Contact
└── Footer
  • App: Root component, contains navigation and routes.
  • NavigationMenu: Links to main pages.
  • Routes: Renders the correct page based on URL.
  • Footer: (Optional) Site-wide footer.

4. Prepare a Navigation Menu Plan

A navigation menu is typically a horizontal bar at the top, with links to each page. Using React Router’s NavLink makes highlighting the active page easy.

Example Navigation Plan:

  • Home | About | Services | Contact

Each link uses a <NavLink> with the corresponding path.

Mini-Project: Write Down Your Page Plan

Take a minute to jot down the pages you want for your brochure site and their URLs. For example:

  • / – Home
  • /about – About
  • /services – Services
  • /contact – Contact

This plan will guide your Route setup in the next part.

Tip Keep your navigation simple—4-6 main links is ideal for most brochure sites.

What’s Next?

Now that you have a roadmap, you’re ready to implement multi-page navigation using React Router. In the next part, you’ll create page components, build the navigation menu, and wire everything together using the concepts and setup from Part 1.

Further Reading


Building Pages and Routing with React Router

In Part 1, you laid the groundwork for your React brochure website and installed react-router-dom. Now, it's time to bring your brochure to life by creating individual pages—such as Home, About, Services, and Contact—and connecting them with React Router. This section walks you through building each page as a React component and wiring up the routes so visitors can seamlessly navigate your multi-page site.

By the end of this section, you'll have a working example of multi-page navigation using React Router basics, a crucial skill for any React website structure.

1. Create a Page Component for Each Section

Let's start by creating a folder for your page components, then add one file per page:

  1. Inside your src directory, create a new folder named pages.
  2. For each brochure page, create a separate file:
    • Home.js
    • About.js
    • Services.js
    • Contact.js

Each file should export a functional component. For example:

// src/pages/Home.js
function Home() {
  return (
    <div>
      <h1>Welcome to Our Brochure Website</h1>
      <p>This is the home page. Explore our services and get to know us!</p>
    </div>
  );
}
export default Home;

Repeat similar structure for About, Services, and Contact pages. Keep the content simple for now—you can enhance it later.

2. Set Up Routes in Your Main App

With your page components ready, it's time to define routes. In your App.js (or wherever your main app component lives):

  1. Import the necessary router components:
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import Home from './pages/Home';
import About from './pages/About';
import Services from './pages/Services';
import Contact from './pages/Contact';
  1. Wrap your app content in a <Router> and define routes with <Routes> and <Route>:
function App() {
  return (
    <Router>
      <Routes>
        <Route path="/" element={<Home />} />
        <Route path="/about" element={<About />} />
        <Route path="/services" element={<Services />} />
        <Route path="/contact" element={<Contact />} />
      </Routes>
    </Router>
  );
}
export default App;
Fact In React Router v6+, all route definitions must be inside a single `` component, and the `element` prop takes a JSX element.

3. Understanding Path Mapping and Route Matching

  • The path prop determines the URL segment that triggers each component.
  • The route with path="/" matches the home page (the root of your site).
  • Sub-pages like /about, /services, and /contact are mapped to their respective components.
  • React Router uses client-side routing, allowing fast, seamless navigation without full page reloads.

4. Testing Navigation Between Pages

You can temporarily navigate by manually typing URLs into the browser. Try visiting /, /about, /services, and /contact to confirm the right page loads each time.

Later, you'll add a navigation menu for user-friendly page switching.

Tip If you see a blank page or get a 404, double-check your `path` values and ensure your components are imported and exported correctly.

Micro-Project: Add a 404 Page

For a professional touch, add a fallback route for undefined URLs:

// In App.js
<Route path="*" element={<div><h2>404 - Page Not Found</h2></div>} />

This ensures users who mistype a URL get a helpful message instead of a blank screen.

Further Reading


Creating a Navigation Menu with React Router

Now that each page and its route are set up, let's build a navigation menu to allow users to move between pages with a single click. A well-designed menu is essential for any brochure website in React, ensuring a smooth user experience and reinforcing your site's structure.

This section uses Link and NavLink components from react-router-dom to create accessible, SPA-style links with active state styling.

1. Implement Navigation with Link and NavLink

  1. Create a new component for your navigation menu, e.g., Navbar.js in the src/components folder.
  2. Import Link or NavLink from react-router-dom:
import { NavLink } from 'react-router-dom';
  1. Structure your navbar:
// src/components/Navbar.js
import { NavLink } from 'react-router-dom';

function Navbar() {
  return (
    <nav>
      <ul>
        <li><NavLink to="/" end>Home</NavLink></li>
        <li><NavLink to="/about">About</NavLink></li>
        <li><NavLink to="/services">Services</NavLink></li>
        <li><NavLink to="/contact">Contact</NavLink></li>
      </ul>
    </nav>
  );
}
export default Navbar;
  • The end prop on the Home link ensures it only matches exactly /.
  • NavLink automatically adds an active class to the link when its route matches the current URL.
  1. Add your Navbar to the main App layout, typically above the <Routes>:
import Navbar from './components/Navbar';

function App() {
  return (
    <Router>
      <Navbar />
      <Routes>
        {/* routes here */}
      </Routes>
    </Router>
  );
}

2. Style Active Navigation Links

To give users visual feedback on their current location, style the active link. You can use CSS:

/* App.css or Navbar.css */
nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

nav a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  padding: 0.5em 1em;
  border-radius: 4px;
}

nav a.active {
  background: #007aff;
  color: #fff;
}

Or, for more control, use the style or className prop as a function:

<NavLink to="/about" className={({ isActive }) => isActive ? 'active' : undefined}>
  About
</NavLink>
Warning Avoid using the native `` tag for internal navigation; it will reload the page and break the SPA experience.

3. Integrate Navigation into the Website Layout

  • Place the Navbar at the top of your page for consistent site-wide navigation.
  • Consider adding a Header or Layout component to wrap your menu and page content—this will become more useful as your site grows (see Part 3).

4. Ensure Accessibility and Usability

  • Use semantic HTML (<nav>, <ul>, <li>) for your navigation.
  • Make sure the menu is keyboard-navigable and readable by screen readers.
  • Use clear, descriptive link text.

Checklist: Accessible Navigation

  • All links are keyboard accessible
  • Active link is visually distinct
  • Navigation uses semantic elements
  • Test with a screen reader if possible

Further Reading


Best Practices and Common Mistakes in React Router Navigation

Professional brochure websites built with React Router not only look good but are robust, maintainable, and easy to navigate. This section explores best practices for structuring your routes, as well as common mistakes that can trip up even experienced developers.

By following these guidelines, you'll create a React website routing structure that's both developer-friendly and user-friendly.

Best Practices for Route Organization

  1. Group related routes: Organize your page components in a logical folder structure (src/pages, src/components).
  2. Use clear, semantic paths: Keep paths lowercase and descriptive (e.g., /about, not /AboutUsPage).
  3. Centralize routes: Define all main routes in one place (like your main App.js or a separate Routes.js).
  4. Add a catch-all route: Use path="*" for 404 handling.
  5. Prepare for scalability: As your site grows, consider using nested routes and layout components (see next section).
Fact React Router's declarative route structure makes it easy to scale from simple brochure sites to complex multi-level applications.

Common Mistakes and How to Avoid Them

  • Using <a href="..."> for navigation: This causes full page reloads. Always use Link or NavLink for internal links.
  • Incorrect path casing: Paths are case-sensitive. Use lowercase to avoid confusion.
  • Forgetting the exact or end prop: In older React Router versions, missing exact could cause multiple matches. In v6+, use end on the root route to prevent unwanted matches.
  • Not handling non-existent routes: Failing to add a fallback (path="*") means users may see a blank page.
  • Placing <Routes> outside <Router>: Always wrap <Routes> inside <Router>.

Step-by-Step: Avoiding Common Routing Pitfalls

  1. Always use <Link> or <NavLink> for navigation between pages.
  2. Double-check your route paths for typos and case-sensitivity.
  3. Add a fallback route as the last route:
    <Route path="*" element={<NotFound />} />
    
  4. Organize your components and routes for clarity and scalability.
Tip When debugging routing issues, use the React Developer Tools and browser address bar to verify which component is rendering for each path.

When to Use Nested Routes

  • If you have pages with their own sub-pages (e.g., /services/design, /services/consulting), nested routes keep your code organized.
  • For simple brochure sites, flat routes are fine—but plan for growth!

Ensuring SEO-Friendly Navigation

  • Use descriptive, keyword-rich URLs (e.g., /about, /services/web-design).
  • Add <title>, meta tags, and canonical URLs using React Helmet or similar libraries to ensure search engines understand your site structure.
  • For static hosting (like Netlify or Vercel), configure rewrites to support client-side routing (covered in the deployment section).

Further Reading


Advanced: Nested Routes and Layout Components

Once your brochure website has the basics down, you can elevate its structure and maintainability with nested routes and shared layout components. This approach is ideal for real-world sites with sections that share headers, footers, or navigation, or that have sub-pages (like individual service descriptions).

This section will guide you through creating a reusable layout component and implementing nested routes in React Router.

1. Create a Reusable Layout Component

Let’s design a layout that wraps your content with a header (navigation), footer, and main content area.

// src/components/Layout.js
import Navbar from './Navbar';

function Layout({ children }) {
  return (
    <div>
      <Navbar />
      <main>{children}</main>
      <footer>© {new Date().getFullYear()} Your Company</footer>
    </div>
  );
}
export default Layout;

However, React Router v6 introduces the <Outlet /> component for nested routing. Update your layout:

import { Outlet } from 'react-router-dom';
import Navbar from './Navbar';

function Layout() {
  return (
    <div>
      <Navbar />
      <main>
        <Outlet />
      </main>
      <footer>© {new Date().getFullYear()} Your Company</footer>
    </div>
  );
}
export default Layout;

2. Implement Nested Routing for Subpages

Suppose your Services page has subpages like Web Design and Consulting. Structure your routes like this:

// In App.js
import Layout from './components/Layout';
import Services from './pages/Services';
import WebDesign from './pages/services/WebDesign';
import Consulting from './pages/services/Consulting';

<Router>
  <Routes>
    <Route path="/" element={<Layout />}>
      <Route index element={<Home />} />
      <Route path="about" element={<About />} />
      <Route path="services" element={<Services />} >
        <Route path="web-design" element={<WebDesign />} />
        <Route path="consulting" element={<Consulting />} />
      </Route>
      <Route path="contact" element={<Contact />} />
      <Route path="*" element={<NotFound />} />
    </Route>
  </Routes>
</Router>
  • The Layout component wraps all your routes, sharing the navbar and footer.
  • The Outlet renders the matched child route.
  • Nested routes under services will show inside the Services page, or you can nest further layouts.

Micro-Project: Add a Nested Services Menu

Inside your Services page, add links to sub-services:

import { Link, Outlet } from 'react-router-dom';

function Services() {
  return (
    <div>
      <h2>Our Services</h2>
      <ul>
        <li><Link to="web-design">Web Design</Link></li>
        <li><Link to="consulting">Consulting</Link></li>
      </ul>
      <Outlet /> {/* Subpage renders here */}
    </div>
  );
}
  • Now, visiting /services/web-design shows the Web Design content within the Services page layout.

3. Share Navigation and Structure Across Pages

By using a layout component with Outlet, you avoid repeating navigation and footer code in every page. This makes your React single page application easier to scale and maintain.

Warning If you forget to use `` in your layout, nested routes won’t render! Always include `` where you want child routes to appear.

4. Understand Route Outlet Concepts

  • <Outlet /> is a placeholder for rendering child routes.
  • Parent routes can provide shared UI (navigation, wrappers) while nested routes inject their own content.
  • This pattern is powerful for both brochure sites and complex apps.

Further Reading


Deploying Your React Brochure Website

After building and testing your React multi-page navigation, the final step is to share your brochure site with the world. Deploying a React app requires a few extra steps to ensure client-side routing works on static hosts like Netlify or Vercel.

This section covers how to build your project, pick a hosting platform, and configure routing for production.

1. Build Your React App for Production

  1. Run the build command:
    npm run build
    # or
    yarn build
    
  2. This creates a build/ folder with optimized static files.

2. Understand Static Hosting Options

  • Netlify and Vercel are popular for React app deployment.
  • Both support static hosting and make it easy to deploy directly from a Git repository.
  • You can also use GitHub Pages, Firebase Hosting, or your own server.

3. Configure Routing for Deployment

React Router uses client-side routing, so you must tell your host to redirect all requests to index.html. Otherwise, deep links like /about will 404 on page reload.

For Netlify:

  1. Create a _redirects file in your public/ folder with this line:
    /*    /index.html   200
    
  2. Netlify will route all URLs to your React app.

For Vercel:

  • Vercel automatically handles SPA routing for React, but you can add a vercel.json for advanced rewrites if needed.
Fact Static hosts must be configured to serve `index.html` for all routes to support React Router navigation after deployment.

4. Troubleshoot Common Deployment Issues

  • 404 errors on refresh: Check your host’s routing configuration.
  • Environment variables not set: Ensure public URLs and API endpoints are correct in production.
  • Static assets not loading: Double-check paths and hosting settings.

Micro-Project: Try Deploying to Netlify

  1. Push your project to GitHub.
  2. Create a new site on Netlify, connect your repository, and deploy.
  3. Visit your live site and test navigation and reloads.

Further Reading


Conclusion and Next Steps

Congratulations! You've now mastered the fundamentals of React Router basics for multi-page navigation in a brochure website. By structuring your app with modular pages, declarative routes, and a robust navigation menu, you've laid the foundation for a professional React single page application.

Here’s what you’ve accomplished:

  • Built individual React components for each brochure page
  • Set up client-side routing with React Router DOM
  • Implemented an accessible, styled navigation menu using NavLink
  • Avoided common routing mistakes and followed best practices
  • Explored advanced concepts like nested routes and layout components
  • Prepared your site for deployment on modern static hosts
Tip Now is a great time to enhance your brochure site with animations, responsive design, or even contact forms. React Router is a solid base for many features!

Common Questions

  • Is React Router suitable for brochure websites?
    • Absolutely. React Router makes even small sites more maintainable and user-friendly.
  • How do I structure a brochure website in React?
    • Organize by pages and components, centralize your routes, and use a layout component for shared structure.
  • What’s next after the basics?
    • Try dynamic routes, authentication, or server-side rendering for more advanced projects.

Next Steps

  • Experiment with route parameters and dynamic content
  • Explore advanced React Router features (like loaders, data APIs, or transitions)
  • Learn about SEO and accessibility for React SPAs
  • Join the React community to stay up-to-date

Further Reading

In the next part, we’ll explore even more advanced navigation patterns and show how to extend your brochure website with interactive features. Happy coding!

About Prateeksha Web Design

Prateeksha Web Design helps businesses turn tutorials like "React Router Basics: Multi-Page Navigation for a Brochure Website" into real-world results with custom websites, performance optimization, and automation. From strategy to implementation, our team supports you at every stage of your digital journey.

Chat with us now Contact us today.

Sumeet Shroff
Sumeet Shroff
Sumeet Shroff is a seasoned web developer and educator specializing in React and front-end technologies, passionate about making complex concepts accessible for beginners and professionals alike.