module.js
import React from 'react';
export function Home() {
return <h2>Home</h2>;
}
export function About() {
return <h2>About</h2>;
}
export function Users() {
return <div><h2>
Users</h2>
</div>;
}
export function ErrorPage() {
return <h1>404Code, GoAway</h1>
}
export function Hello() {
return <h2>Hello</h2>;
}
export function Say() {
return <h2>Say</h2>;
}
routes.js
import { Home, About, Users, ErrorPage, Say, Hello, } from './module.js';
const routes = [
{
path: '/home',
component: Home
},
{
path: '/about',
component: About
},
{
path: '/users',
component: Users
},
{
path: '/error',
component: ErrorPage
},