Network error when attempting to fetch resource (NS_BINDING_ABORTED)

1k views Asked by At

I keep getting the same error which is network error, specifically NS_BINDING_ABORTED when running the below code from my react app. I'm pretty sure it's something about the code I wrote because I've tried with other API's and I also have another project that successfully calls an API.

import React, {useState} from 'react';


function App() {
  const [userTickerValue, setUserTickerValue] = useState('')
  
  const handleChangeTickerInput = (event) => {
    setUserTickerValue(event.target.value)
  }
  
  const key=(taken out for privacy)
  

  const handleFormSubmit = () => {
    console.log(userTickerValue)
      fetch(`https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY&symbol=${userTickerValue}&apikey=${key}`)
      .then(res => res.json())
      .then(data => {
          console.log(data)
      })
  }
  
  return (
    <div className="App">
      <form onSubmit={handleFormSubmit}>
        <p>Ticker?<input type='text' value={userTickerValue} onChange={handleChangeTickerInput}></input></p>
      </form>
    </div>
  );
}

export default App;

0

There are 0 answers