Grokking React Native
0% completed
Query Invalidation and Refetching
await queryClient.invalidateQueries(['users']); await queryClient.invalidateQueries({ queryKey: ['users'] });
These two lines look equivalent, and many tutorials show the first one. A screen with one query for users and one for posts printed these request counts:
on mount users 1, posts 1 after invalidateQueries(['users']) users 2, posts 2 after invalidateQueries({ queryKey: [...]}) users 3, posts 2
The first form is the old way of calling this function
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%