-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
It seems to me that isLoading should be true by default.
If you have the following:
const MyComponent = () => {
const {isLoading, data} = useQuery("todos", fetchTodos);
if(isLoading) {
return <Spinner />;
}
if(!data) {
return "You don't have any todos";
}
return <div>Your todos: {data}</div>
}
Currently in with this code you will see a flash of "you don't have any todos", followed by the spinner, followed by Your todos: foo
. We want our UX to be just followed by the data, w/out the flash of empty data content first.
As far as I could tell there's nothing in the api that allows you to set the initial state to 'isLoading' to be true. Is there any way to accomplish this?
JaapWeijland, badsyntax, ocho-cesar, bestickley and Arian-Hamdi
Metadata
Metadata
Assignees
Labels
No labels