DEV Community

Discussion on: Deploy Rails API on Heroku and Vanilla JavaScript on Netlify

Collapse
 
fentybit profile image
fentybit

Thank you Muhammad!
The app was built with Vanilla JS.
Do you think I would need to utilize a framework for optimizations?

Collapse
 
devtalhaakbar profile image
Muhammad Talha Akbar • Edited

No, your Vanilla JS is alright.

For example, take network optimization. I saw that you were loading all questions for all categories ahead of time. In my opinion, with SPAs, we should load the data progressively and ideally only what needs to be displayed at the time. So, load categories when the user presses the Play button. Then, load questions for the selected category only when the user actually selects a category. I would have even gone to load only the current question depending upon the use case.

But, in the end, everything is a trade-off. Here, you'll be increasing code complexity to optimize network usage. When building apps, you have to be the judge. Should you go for optimizing network at the expense of potentially increasing code complexity? Personally, in this case, I would.

Thread Thread
 
fentybit profile image
fentybit

Thank you so much for this! I will definitely re-assess my OOJS, however benefits the app's best optimisation. I really appreciate much of your time in looking into this, very insightful feedback. ☺️