Protected Routes in Gatsby with @reach router

Veröffentlicht am: 16. April 2020

Lesedauer: 1 Min.

Kategorien:
import React from 'react'
import { Router } from '@reach/router'

const Home = () => <p>Home</p>
const Settings = () => <p>Settings</p>
const Billing = () => <p>Billing</p>

const Account = () => (
    <Router>
        <Home path="/account" />
        <Settings path="/account/settings" />
        <Billing path="/account/billing" />
    </Router>
)

export default Account

Articles in related Categories

  • Gatsby blog with Contentful
  • 18. März 2020

  • Default props in React and Gatsby
  • 16. April 2020

  • Pagination in Gatsby
  • 16. April 2020