I am having some trouble with my local json file not being recognized in React with fetch()
Code below:
import React, { useState, useEffect } from 'react';
import Datatable from "./datatable";
import Data from './data/data.json';
import './App.css';
require("es6-promise").polyfill();
require("isomorphic-fetch");
export default function App() {
const [data, setData] = useState([])
const [q, setQ] = useState("");
const [searchColumns, setSearchColumns] = useState(["first_name", "last_name"]);
useEffect(() => {
fetch(Data)
.then(response => response.json())
.then(json => setData(json));
}, []);
... some add'l code continues which I can add if helpful.
I'm literally just getting a blank page. I also tried fetching the actual path to the json file out of curiosity, but I received a webpack loader error.
Any insights would be helpful.