Im getting an error stating that fs.readFile
is not a function. What am I not understanding about how to use fs.readFile
?
https://www.geeksforgeeks.org/node-js-fs-readfile-method/
The objective here is to get the contents of my file into a variable and parse thought the value further.
import React from 'react';
const fs = require('fs')
const ToolTipTextMod = (props) => {
let txt = null;
fs.readFile('../../components/ToolTip/ToolTipText.txt',(err, data) => {console.log(data)})
return(
<p>{txt},{props.textId}</p>
);
}
export default ToolTipTextMod;