Tinkoff / tramvai

A modular framework for universal JS applications
https://tramvai.dev/
Apache License 2.0
232 stars 11 forks source link

How can this be distinguished from the situation when an empty array has arrived? #9

Closed polRk closed 2 years ago

polRk commented 2 years ago

https://github.com/Tinkoff/tramvai/blob/1e52b82b994732283e3a0d9399230959de9b9948/docs/tutorials/pokedex-app/04-fetch-data.md?plain=1#L317

SuperOleg39 commented 2 years ago

Hello!

For real-world cases, I can recommend a few options:

  1. Use react-query for API requests, there will be a useful flags for request current state
  2. More classic, "redux-like" option, add some flag to PokemonsStore, e.g. isFetching, and some events like requestStart, requestSuccess and requestFail. It can be a different store, for performance reason.