DEV Community

miguelille
miguelille

Posted on

JS Experts! May you help me to learn the best workflow using APIs and Redux? [question for experts]

Hi guys!

I'm thinking about doing a dummy application that calls a big videogame API to train React, TypeScript, and Redux toolkit.

My idea is to show all the games available on the home page ordered by the most popular to the less popular, with an infinity scroll to load progressively. The app will have a search bar too, just in case the user wants to see a specific game, and maybe I add a little shopping cart.

A quite simple idea, I know how to do it but there are certain things that I have some doubts about how to proceed to do it as the best possible way:

1º Should I save the games fetched in the infinite scroll of popular games in a global state like a redux toolkit? Is it a good idea to cache in some way in the client browser in case the user reloads the web and have a good amount of games already downloaded?

2º When a user searches some game should I search first in the state to 'fast' first results and then an API call? or directly search through the API?

3º How many games should I load in the first instance? 100? and then load in bumbles of 25 when the user scrolls down?

4º Maybe is viable to load the whole amount of videogames at once if in the API there are 1000? or is it too much work for the client?

5º If I want to save something like a theme should I use the redux toolkit too or context?

Thanks in advance!

Alt Text

Top comments (0)