GithubHelp home page GithubHelp logo

e-nk / react-hooks-react-router-routes-lab Goto Github PK

View Code? Open in Web Editor NEW

This project forked from learn-co-curriculum/react-hooks-react-router-routes-lab

0.0 0.0 0.0 966 KB

License: Other

JavaScript 86.27% HTML 13.73%

react-hooks-react-router-routes-lab's Introduction

Basic Routes Lab

Learning Goals

  • Use the <Route> component to display different components based on the URL
  • Use the <NavBar> component to allow client-side navigation

Introduction

In this lab we are going to build out a Movie application that has routes for a Home Page, Actors Page, Movies Page and Directors Page. Our goal is to provide routes and links for these 4 pages.

Here is what each page of our app should look like when we are done with this lab:

Let's work through this one component at a time.

Setup

Our src folder contains the following:

src/
├── data.js
├── index.js
└── components/
    ├── App.js
    ├── Actors.js
    ├── Directors.js
    ├── Home.js
    ├── Movies.js
    └── NavBar.js

All of the file and module imports are done for you, so you just need to focus on the JSX for these components.

index.js

Our index.js file is completed for us. It loads the BrowserRouter component from React Router, as well as App as the top level component.

data.js

This file contains seed data for Actors, Movies, and Directors.

Components

App

Inside this component, we'll need to render our NavBar and four React Router Route components with the following paths:

  • /movies: should render the Movies component
  • /directors: should render the Directors component
  • /actors: should render the Actors component
  • /: should render the Home component

NavBar

This component needs to render four NavLink components. They will be for /, /movies, /directors, /actors, in this order (test checks for this).

Home

This component should render the text Home Page in an <h1>.

Movies

This component should render the text Movies Page in an <h1>, and make a new <div> for each movie. The <div> should contain the movie's title, time and a <ul> with a list of its genres, each within their own <li>.

Directors

This component should render the text Directors Page in an <h1>, and make a new <div> for each director. The <div> should contain the director's name and a <ul> with a list of their movies.

Actors

This component should render the text Actors Page in an <h1>, and make a new <div> for each actor. The <div> should contain the actor's name and a <ul> with a list of their movies.

Note: The tests will count how many <div>s are nested inside your Movies, Directors, and Actors components. So to get tests to pass, you must create exactly one <div> for each movie, director, or actor, and no additional nested <div>s in those components.

Resources

react-hooks-react-router-routes-lab's People

Contributors

lukeghenco avatar dependabot[bot] avatar lizbur10 avatar rrcobb avatar ihollander avatar maxwellbenton avatar thuyanduong-flatiron avatar jeffkatzy avatar achasveachas avatar jlboba avatar aturkewi avatar crwhitesides avatar jjseymour avatar e-nk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.