Coder Social home page Coder Social logo

ph2-react-router's Introduction

React Router DOM

Learning Goals

  • Understand what react-router as a package does
  • Create a configurable object
  • Implement routing for a main App page
  • Implement an error page with useRouteError
  • Utilize the Outlet component to show children in a wrapper
  • Understand the async / await syntax for fetching
  • Utilize the useLoader hook
  • Create pages with params using the useParams hook
  • Programatically navigate to new pages with useNavigate

Getting Started

Fork and clone the repository. Run npm install. We'll need to install the react-router-dom package followed by npm run server. In a seperate window run npm start.

Deliverables

CaseList

  1. Create a new route for the cases. The path ought to be /cases and the component should be CaseList.

  2. Create a new Link in the Header that sends users to /cases.

  3. Apply a new loader which fetches data from cases and loads it when routing to /cases.

  4. Receive and map through the loaded data in the CaseList component using the useLoaderData hook.

CasePage

  1. Create a new route for the individual case page. The path ought to be /cases/:id and the component should be CasePage.

  2. Apply a new loader which fetches data for an individual case using params and loads it when routing to /cases/:id.

  3. Receive and use the loaded data in the CasePage component.

  4. Apply error handling to the loader in case you receive something other than an ok response.

ph2-react-router's People

Contributors

brewchetta 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.