Reputation: 681
I made a workout app and I'm using Redux to save all of the sets and workouts. Right now I hand typed all of exercises into Redux data to test things out. I have all of the exercises in a .json
file and I wanted to import it into the app so users would have access to them.
Would I need to import the .json
file into Redux or different part of the app and then somehow give redux access to them? I confused because users would select the exercises and they can add descriptions, change number of sets and reps (which are all in Redux).
I'm new to coding hence why I haven't gone through the api route. I just want to get the beta version out. Also they are thousands of exercises in that .json
file and that's why I haven't manually entered them into Redux.
Upvotes: 2
Views: 181
Reputation: 6967
You can read your local JSON file like this and then access exerciseData like a normal JS object
const exerciseData = require('./exerciseData.json');
Upvotes: 1