State Management · Junior · Question 45 of 75
What does createApi generate for an endpoint getPosts: builder.query(...)?
- ✓Correct answer: A hook
useGetPostsQueryplus a reducer and middleware for the store - 2A REST server that serves the posts
- 3A slice with
getPostsas a case reducer
Explanation
The API slice's reducer and middleware are added to configureStore, and components call the generated hook: const { data, isLoading } = useGetPostsQuery().