State Management · Junior · Question 32 of 75
Where should a request to the server live in Redux Toolkit?
- ✓Correct answer: In a thunk (
createAsyncThunk) or an RTK Query endpoint - not in a reducer - 2Directly inside the reducer, since it computes the new state
- 3In the
initialStateof the slice
Explanation
Reducers must be pure. createAsyncThunk dispatches pending/fulfilled/rejected around the request; for cached server data RTK Query is usually simpler.