Skip to content

Instantly share code, notes, and snippets.

@mjackson
Created October 30, 2019 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjackson/caefdc626afb9f0c08b610740e5e8016 to your computer and use it in GitHub Desktop.
Save mjackson/caefdc626afb9f0c08b610740e5e8016 to your computer and use it in GitHub Desktop.
import React from 'react';
import { lazy } from 'react-suspense-resource';
let Courses = lazy(() => import('./Courses.js'));
let CoursesIndex = lazy(() => import('./CoursesIndex.js'));
let routes = [
{
path: "courses",
element: <Courses />,
routes: [
{
path: ":id",
element: <Course />,
preload: ({ params: { id } }) => getCourse(id)
},
{ path: "new", element: <NewCourse /> },
{ path: ".", element: <CoursesIndex /> },
{ path: "*", element: <CoursesNotFound /> }
]
},
{
path: "courses",
element: <Landing />,
routes: [
{ path: "react-fundamentals", element: <ReactFundamentalsLanding /> },
{ path: "advanced-react", element: <AdvancedReactLanding /> }
]
},
{ path: ".", element: <Home /> }
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment