Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

176
Views
React useEffect Api call with fetch gives SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data

I am using React with hooks to make a call to an open API. Somehow, the error keeps showing when I try to log the data to the console: "SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data". I'm not sure what's going wrong because postman is showing a perfectly fine object. Any help would be highly appreciated.

import React, {useState, useEffect} from 'react'

function App() {
  const [isLoading, setLoading] = useState(true)
  const [apb, setApb ] = useState([])
  useEffect(() => {
    fetch(
      'https://api.politie.nl/v4/vermist?language=nl&radius=5.0&maxnumberofitems=10&offset=0',
      {
        method: "get",
        mode: "no-cors",
        headers: new Headers({
          'Content-Type': 'application/json'
        }),
      }
    )
    .then(res => res.json())
    .then(response => {console.log(response)})
    .catch (error => {console.log(error)})
  },[]);
  return (
    <div className="App">
      <Header/>
      <SubMenu/>
      {isLoading ? <p>Loading</p> : <p>Loaded</p>}
    </div>
  );
}

export default App;
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!