简体   繁体   中英

Where should I put local JSON file in React project?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM