Giter Site home page Giter Site logo

benspector-mls / react-router-with-fetch-and-context Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 66 KB

A demonstration of React skills

License: MIT License

JavaScript 66.82% HTML 5.24% CSS 27.94%
react react-context-api react-router-dom react-useeffect react-usestate

react-router-with-fetch-and-context's Introduction

Building the Products Application

I used this API: https://dummyjson.com/

  1. Create main page components (Dashboard, About, Products, Product)
  2. Define routes for them using BrowserRouter, Routes, and Route
  3. Make a navigation bar with NavLinks
  4. Create ProductsContext and ProductsProvider
  5. Wrap the application in the Provider
  6. Define state values in Provider with useState
  7. Set the state data in Provider with useEffect and fetch (note the utils file with the handleFetch helper)
  8. Products as a directory of product pages
    • Use context to get the fetched data
    • Render a list of Links to for each fetched product
  9. /products:id โžก Product to render a single product
    • Grab the dynamic segment of the URL (id) with useParams()
    • Get the current product from the context
    • Render the product's data!

react-router-with-fetch-and-context's People

Contributors

benspector-mls avatar

Watchers

 avatar

Forkers

danielnelson37

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.