createAsyncThunkintermediatebuilder.addCase(loadPosts.fulfilled, (state, action) => {
state.items = action.payload
state.loaded = true
})The fulfilled handler receives the resolved value as action.payload β assign it directly to state with Immer.
The fulfilled action carries the resolved value as action.payload. Use it to store fetched data in your slice.
Challenge: Create a loadPosts thunk and update items and loaded state on fulfillment.
postsSlice.reducer(undefined, loadPosts.fulfilled(['post1','post2'], 'req'))
// β { items: ['post1', 'post2'], loaded: true }