react api call
How to fetch data from api Examples with typescript const [data, setData] = useState([]) const [error, setError] = useState('') useEffect(() => { axios.get('http://localhost:4000/superheroes') .then((_res:any) => { console.log(_res.data); setData(_res.data) }) .catch(error => { setError(error.message) }) }, [])