Q: TypeError: _fs.readFileSync is not a function I  start learning react and trying to retrieve  data from ".csv" file but I am getting this error while try to read the file (TypeError: _fs.readFileSync is not a function)
I am getting the error  from this line =>
 var workbook = xlsx.readFile("./LabeledDataset.csv" , { type:'binary'});
my code
import React, { useState } from 'react';
import * as XLSX from 'xlsx';
import DataTable from 'react-data-table-component';

function App() {


  // handle reading the file
  const handleFileUpload = () => {
    var workbook = XLSX.readFile("./LabeledDataset.xlsx" , { type:'binary'});
    var wsname = workbook.SheetNames[0];
    const ws = workbook.Sheets[wsname];
    var data = XLSX.utils.sheet_to_csv(ws, { header: 1 });


    console.log(data);

     };
    
  }
  return (
    <div>
      <button
        type="file"
        accept=".csv,.xlsx,.xls"
        onClick={handleFileUpload}
      >click</button>
     
    </div>
  );
}

export default App;


A: This code will not work on the client side, due to the use of fs. If you want to run tasks like this you'll need to perform them on a web server with node.
