US States

फ्रीमियम
Verified
द्वारा Aptitude Apps, LLC | अपडेट किया गया לפני חודשיים | Data
लोकप्रियता

8.6 / 10

लेटेंसी

491ms

सेवा का स्तर

100%

Health Check

N/A

सभी चर्चाओं पर वापस जाएं

API Error

Rapid account: Ekoen 56
ekoen56
לפני שנה

I am getting an error and I don’t know what it means. I haven’t changed anything in the code segment that fetches data from the API and stores it.

This is the error: Error: “Unexpected token ‘O’, “Oops, an e”… is not valid JSON” in SyntaxError: Unexpected token ‘O’, “Oops, an e”… is not valid JSON"

Here’s the code:

const options = {
method: ‘GET’,
headers: {
‘X-RapidAPI-Key’: ‘0c7e651446msh9d309a885c79429p1421dejsna49fa790aca8’,
‘X-RapidAPI-Host’: ‘us-states.p.rapidapi.com’,
},
};
componentDidMount = () => {
return fetch(‘https://us-states.p.rapidapi.com/all’, options)
.then((response) => response.json())
.then((response) => {
console.log(response);
this.setState({
isLoading: false,
dataSource: response,
});
})
.catch((error) => {
console.log(error);
});
};

चर्चा में शामिल हों - नीचे टिप्पणी जोड़ें:

नई टिप्पणियाँ पोस्ट करने के लिए लॉग इन / साइनअप करें