State Management · Senior · Question 74 of 75
What's wrong with providesTags: (result) => result.map(({ id }) => ({ type: "Post", id }))?
- ✓Correct answer: If the query fails,
resultisundefinedand the function throws; return fallback tags for the error case - 2Tags must be strings
- 3Nothing; it's the recommended form
Explanation
Write result ? [...result.map(...), { type: "Post", id: "LIST" }] : [{ type: "Post", id: "LIST" }] so a later mutation can still trigger a refetch after an error.