Answers for "how to call api in react"

0

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)
          
        })

      }, [])
Posted by: Guest on October-22-2021
0

react api call

;ksmclksamcklsc
Posted by: Guest on October-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language