Giter VIP home page Giter VIP logo

livecoding-callapi-pokemon's Introduction

Pokemon List - API call

Goal :

Create a list of Pokemon with the data from 'PokeAPI'

Steps :

  1. A component Pokemon in a component PokemonList without API call.
  2. In PokemonList, I use fetch to call the API with the URL https://pokeapi.co/api/v2/pokemon and get a response which I display in the console.
  3. In PokemonList, I use then to specify what function should be executed when the browser receive the PokeApi response. We use the json() response method to make it an object.
  4. In PokemonList, I create a State with an attribute pokemons with the value [ ] by default.
    In my API call I change the value of pokemons with setState after I got my JSON response. I log this.state.pokemons in render or I use react inspector to see state change.
  5. I create a list with .map() on my array pokemons from state, and I use props to get my pokemon name in the component Pokemon.

livecoding-callapi-pokemon's People

Contributors

erabin05 avatar

Watchers

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