I am following the official doc to learn RTK query. But, I am not sure what is the difference between doing the cache invalidation like this
getUsers: build.query<User[], void>({
query: () => '/users',
providesTags: ['User'],
}),
and this
providesTags: (result, error, arg) =>
result
? [...result.map(({ id }) => ({ type: 'Post' as const, id })), 'Post']
: ['Post'],
The doc explains For more granular control over the provided data, provided tags can have an associated id. This enables a distinction between 'any of a particular tag type', and 'aa specific instance of a particular tag type'.
But, I have no idea what it means. Same for the invalidatesTags