I followed a few articles on how to read json data from a local file in React and they are recommending using map function. Like https://morioh.com/p/316b1492cfda
I am getting an error
Property 'map' does not exist on type '{ updated: number; }'.ts(223)
Here is my code
import UpdatedFile from '../public/updated.json';const[Updated,setUpdated]= useState("9/9/2020"); const newdata = UpdatedFile.map((data) =>{ // This is where the error is coming return ( setUpdated({map.updated}) ) });
This is how my JSON file looks like.
{"updated": 1599692605913}
Any idea why its not recognizing map as a valid function?