Please review the axios code

 avatar
unknown
javascript
4 years ago
723 B
12
Indexable
import React, { useState } from 'react';
import './App.css';
import Axios from "axios";

function App() {
  const[pokemonName, setPokemonName] = useState("");
  const searchPokemon = () => {
    Axios.get(`https://pokeapi.co/api/v2/pokemon/${pokemonName}`).
    then((response) => {
      console.log(response);
    })
  }
  return(
    <div className = "App">
      <div className = "TitleSection">
        <h1>Pokemon Stats</h1>
        <input 
          type = "text" 
          onChange={(event)=> {
          setPokemonName(event.target.value);
        }}
       />
        <button onClick={searchPokemon}>Search Pokemon</button>
      </div>
    </div> 
  
  );
}

export default App;
Editor is loading...