ReactPWA

ReactPWA

  • Docs
  • Features
  • Blog
  • Examples
  • Help

›Routing

Getting Started

  • Initial setup
  • PawJS Configuration
  • Web App manifest

Guide

  • External resources
  • Internal APIs
  • Environment Variables

Routing

  • Add new route
  • Async routing
  • Nested routes

Plugins

  • Redux
  • Image Optimization
  • Sass
  • LESS

Deployments

  • Heroku
  • Amazon EC2
  • Digital Ocean
Edit

Nested routes

Add Nested Routes

Benefits of Nested Routing: Rewrite sections of a page rather than loading entire new pages.
You can add nested routes as follows:

// ... other imports
import Blog from "./components/blog";
import NestedRouteDemo from "./components/nested-route-demo"
  // ... code
  // ... other routes
  {
    path: "/blog",
    abstract: true,
    component: Blog,
    routes: [
      {
        path: "/blog/nested-route-demo",
        exact: true,
        component: NestedRouteDemo
      }
    ]
  }
  // ... code

In blog.js add following code:

import React, {Component} from "react";
import { renderRoutes } from "react-router-config";
export default class Blog extends Component {
  render() {
    return (
      <div>
        <!-- display common content in all sub-routes -->
        <h1>Blog</h1>
        <!--To render Sub-Routes -->
        <div>{renderRoutes(this.props.route.routes)}</div>
      </div>
    );
  }
}
← Async routingRedux →
  • Add Nested Routes
ReactPWA
Docs
Getting StartedPluginsExamples
Community
User ShowcaseProject Chat
More
BlogGitHubStar

Giants supporting us

Atyantik Technologies Private LimitedDigitalOceanEventerpriseBrowserStackNavicat
 
Support ReactPWA

Copyright © 2019 Atyantik Technologies Private Limited