0

I'm trying to fetch .csv data in react, however it returns as it below. I'm not sure why does it happen.

["<!DOCTYPE html>↵<html lang="en">↵  <head>↵    <met…tatic/js/main.chunk.js"></script></body>↵</html>↵"]

My code to fetch data.

 async function getDummyData (){
      const URL = '../MockData/dummyData.csv';
      let data = await fetch(URL);
      data = await data.text();
      let dummyData = CSV.split('\r\n');
    }
    getDummyData();

However, code works as it should be on Vanilla JS and returns data of 100 paragraphs.

Thanks in advance for any help.

2
  • possible duplicate of stackoverflow.com/questions/53416529/… Commented Feb 15, 2021 at 17:03
  • The URL you have points to an HTML document (it looks like the bootstrap HTML document that loads your React application). Likely this is a server configuration issue. Commented Feb 15, 2021 at 17:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.