FrontEnd web
Published in

FrontEnd web


How to read local JSON files in React.js?

react js tutorial by Rajdeep Singh

Demo And Code Here

demo blog uses JSON data


  1. No Need for Axios or Fetch
  2. Import File
  3. Map() Method ( Function)
  4. 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.

Tips: use an array when creating a JSON Object file that looks like this:

Use my tips after using map() other wish show an error on your browser.

Why did you not use Axios or Fetch?

Axios or Fetch is used to get or post data into the server. In our case, we read on the local folder file, so we use map().

Why do you use the map() Method?

I use a map() because it may be easy for me if you use any other method like every(), forEach() other maybe work.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rajdeep singh

Rajdeep singh


JavaScript || Reactjs || Nextjs || Python || Rust || Biotechnology || Bioinformatic || Front-end Developer || Writer ||