I have my Airtable in a “MainAPI.JS” file, it’s not in my APP.js, I don’t want the products on “every” page. Sooo does that mean I should have it on the “page” instead of the App.js?
I have a MainAPI.js then I have FishAPI.js and CoralAPI.js for the “objects” to loop through. So, do I add the connection to the takes on the “page” that it’s for?
Instead of the App.js?
Top comments (1)
Great post! The structure you’ve outlined for using Airtable APIs within React is clear and efficient. Separating API logic into dedicated components like MainAPI.js, FishAPI.js, and CoralAPI.js ensures your code remains modular and easy to maintain. Regarding your question, if the data is only needed on specific pages, it makes sense to handle the API connection directly in those pages instead of globally in App.js.
If you need more insights or best practices on structuring your React components and API integrations, feel free to visit our resources at our Airtable Webpage. Keep up the great work!