Where should I put local JSON file in React project?

Viewed 41

I have created one JSON configuration file in react project. Following is the project structure where I kept userProvisions.json file ->

.
└── /config
└── /public
└── /src
    └── /utils
        ├── userProvisions.json

Question: Is it a good practice to keep configuration file (userProvisions.json) in src folder ?

1 Answers

It all depends on the purpose of the file, if it is a simple file and you don't have any problem with anyone accessing that file, you can store it where-ever you want, however, on the other hand if it contains crucial data, you can't prevent others from seeing that file. You should use a database to store and process that data.

Seeing your folder structure it is a good idea to store the "JSON configuration file" in ./config/... -> it's totally up to you.

Related