Coder Social home page Coder Social logo

lab-react-api's Introduction

Logo-nav

Learning Goals:

The aim of this lab is to use axios and fetch data from an external api.

Use the following code - to fetch the api:

axios.get("https://reactnd-books-api.udacity.com/books",{ headers: { 'Authorization': 'whatever-you-want' }})

NOTE: The above piece of code is not enough to get data from the given api, you need to use .then in order to resolve the promise into the API's response. If there is any error -> print that error on console. If the status code === 404: then display as shown below:

(You can experiment this by giving a wrong url like given in the picture 'book' without 's')

The above exercise will help you to play around error handling through axios.

Steps to follow:

  1. Create a new react app. Name it as react-api

  2. Display the following content by fetching the data, from the above given api.

    1. Title of the book
    2. Image of the book (in the given api --> there are two image links --> you can use any-one)
    3. Descripition of the book
    4. Authors of the book

Here is demo of the final output:

Happy Coding ❤️!

lab-react-api's People

Contributors

kalvium-program avatar shnekithaa 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.