#React.js
How to read local JSON files in React.js?
Published in
3 min readNov 18, 2019
Hey everybody, my name is Rajdeep Singh. In this post, I’m telling you How to read the JSON file in react.js within a simple step.
Demo And Code Here
Requirement
- No Need for Axios or Fetch
- Import File
- Map() Method ( Function)
- QNA
Look Like this Example:
Step: 1
Import the JSON file. On your work file, uses the Import method.
import data from ‘./data/data.json’;
Step: 2
when you import after using the map() method, loop all the items in the JSON file.
Interesting fact map() method used only for the array. But in our JSON file Format…