August 2017
Beginner
374 pages
10h 41m
English
It's time to create the actual Router component, which will take the route state as a property and decide which page to show based on it. To create the Router component, perform the following steps:
import React from 'react'import MainPage from './pages/MainPage.jsx'import AboutPage from './pages/AboutPage.jsx'
const Router = ({ route }) => {
switch (route) { case 'about': return <AboutPage /> default: case 'main': return <MainPage /> }}
Read now
Unlock full access