Giter VIP home page Giter VIP logo

fetch-and-react-routing's Introduction

Performing Fetch and Routing with a react app

Refer to the image below:


fetch and routing practice desktop output

Design Files

Click to view

Set Up Instructions

Click to view
  • Download dependencies by running npm install
  • Start up the app using npm start
API Requests & Responses

blogsApiUrl

API: https://apis.ccbp.in/blogs

Method: GET

Description:

Returns a response containing the list of all blogs

Response

[
  {
    "id": 1,
    "title": "React v16.9.0 and the Roadmap Update",
    "image_url": "https://miro.medium.com/max/1050/1*i3hzpSEiEEMTuWIYviYweQ.png",
    "avatar_url": "https://miro.medium.com/max/4096/1*wiOSfPd2sY0gXSNK9vv6bg.jpeg",
    "author": "Dan Abramov,",
    "topic": "React.js"
  },
  ...
]

blogItemDetailsApiUrl

API: https://apis.ccbp.in/blogs/:id

Example: https://apis.ccbp.in/blogs/2

Method: GET

Description:

Returns a response containing the details of the specific blog

Response

{
  "id": 2,
  "title": "React v16.7: No, This Is Not the One With Hooks",
  "image_url": "https://miro.medium.com/max/3158/1*kEPCQNY4dwVyaFuLEwJcNQ.png",
  "avatar_url": "https://avatars.githubusercontent.com/u/3624098?v=4",
  "author": "Andrew Clark",
  "content": "React follows semantic versioning. Typically, this means that we use patch versions for bugfixes, and minors for new (non-breaking) features. However, we reserve the option to release minor versions even if they do not include new features. The motivation is to reserve patches for changes that have a very low chance of breaking. Patches are the most important type of release because they sometimes contain critical bugfixes.",
  "topic": "React.js"
}
Components Structure
fetch and routing practice home component breakdown structure

fetch and routing practice blog item component breakdown structure

Implementation Files

Use these files to complete the implementation:

  • src/App.js
  • src/components/Home/index.js
  • src/components/BlogList/index.js
  • src/components/BlogList/index.css
  • src/components/BlogItem/index.js
  • src/components/BlogItem/index.css
  • src/components/BlogItemDetails/index.js
  • src/components/BlogItemDetails/index.css

Important Note

Click to view

The following instructions are required for the tests to pass

  • Home route should consist of / in the URL path

  • About route should consist of /about in the URL path

  • Contact route should consist of /contact in the URL path

  • BlogItemDetails route should consist of /blogs/:id in the URL path

  • No need to use the BrowserRouter in App.js as we have already included in index.js file

  • Wrap the Loader component with an HTML container element and add the data-testid attribute value as loader to it as shown below

    <div data-testid="loader">
      <Loader type="TailSpin" color="#00bfff" height={50} width={50} />
    </div>

Resources

Colors
Hex: #8e8e8e
Hex: #000000
Hex: #d3d3d3
Hex: #2f4f4f
Font-families
  • Roboto

fetch-and-react-routing's People

Contributors

reddy-epk avatar

Watchers

 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.