ZacCrumpton / front-end-capstone

0 stars 0 forks source link

Routing #8

Open ZacCrumpton opened 4 years ago

ZacCrumpton commented 4 years ago

USER STORY

as a user i need a way to navigate between pages

AC

WHEN i click on a navigation link THEN i should be directed to a new page via routing

DEV NOTES

  1. react routing will be used for this project
  2. import react-dom-routing into the App.js file
    • should look something like this
      import {
      BrowserRouter,
      Route,
      Redirect,
      Switch,
      } from 'react-router-dom';
  3. in the return you should have something similar to what you see in the comments below.
ZacCrumpton commented 4 years ago

Switch statement:

            <Switch>
              <PrivateRoute path='/home' component={Home} authed={authed} />
              <PrivateRoute path='/list/edit/:listId' component={EditList} authed={authed} />
              <PrivateRoute path='/list/new' component={NewListForm} authed={authed} />
              <PrivateRoute path='/list/:listId' component={SingleList} authed={authed} />
              <PrivateRoute path='/list' component={MyLists} authed={authed} />
              <PrivateRoute path='/anime/edit/:animeId' component={EditAnime} authed={authed} />
              <PrivateRoute path='/anime/new' component={NewAnimeForm} authed={authed} />
              <PrivateRoute path='/anime/:animeId' component={SingleAnime} authed={authed} />
              <PublicRoute path='/auth' component={Auth} authed={authed} />
              <Redirect from="*" to="/home"/>
            </Switch>