I'm writing a React app and I would like to load content from local JSON files.
I tried using import Data from "./info/websiteData.json" and it works fine on localhost. However, when I built the app for production, it doesn't include the JSON files and causes errors. So I think I have to keep the JSON on the backend?
If I keep the JSON files on the backend (say, outside of the public_html folder), how do I get their contents when the page loads? Would I have to use XMLHTTPRequest for this? What would you do?
Thanks for your help!