4 ms·
> Loading - A fetch is happening Loading/Fetching can have multiple states. Some I can think of are: 1. Fetching data when there is no data 2. Fetching data t
by _thisdot 3y ago
> Loading - A fetch is happening
Loading/Fetching can have multiple states. Some I can think of are:
1. Fetching data when there is no data
2. Fetching data to replace the data, but the data on the screen is not invalid
3. Fetching data to append to the existing data
All these warrant different states imo. I have some screenshots on Loading/Fetching here: https://rahulkrrrishna.xyz/notes/2024/01/01/loading-vs-fetching.html https://rahulkrrrishna.xyz/notes/2024/01/01/loading-vs-fetch...
I like what `react-query` does. They toggle `isLoading` to true when the data is invalid/nonexistent. All subsequent fetches toggle a different state called `isFetching`