How To Make A HTTP Request With Axios #shorts

preview_player
Показать описание
In this video I will show you how to make a http request with axios in just 60 seconds! #shorts
Рекомендации по теме
Комментарии
Автор

import axios from 'axios';
import { useEffect, useState } from 'react';


export const App = () => {
const [pokemonData, setPokemonData] = useState([]);

useEffect(() => {
const fetchData = async () => {
try {
const response = await axios.get(URL);

} catch (error) {
console.log(error);
}
};

fetchData();
}, []);

return (
<>
<h1>Hello World!</h1>
<ol>
{pokemonData.map((pokemon, i) => (
<li key={i}>{pokemon.name}</li>
))}
</ol>
</>
);
};

withjohnnysee