위와 같은 에러가 뜨면 리덕스툴킷 에러라고 볼 수 있다.
extraReducer의 구조가 변경되면서 생기는 에러 인 것 같다, reduxt-toolkit docs를 확인해본 결과
하단 과 같이 구조를 변경하면 제대로 작동한다.
//error code
extraReducer:{
// [getAllPosting.fulfilled]:(state,action) =>{
// state.status = "success"
// state.postingList = action.payload.postingList
// },
// [getAllPosting.pending]:(state) =>{
// state.status = "pending"
// },
[...]
}
//fixed code
extraReducers:(builder)=>{
builder.addCase(getAllPosting.fulfilled,(state,action)=>{
state.status = "success"
state.postingList = action.payload.postingList
})
builder.addCase(postingSearch.fulfilled,(state,action)=>{
state.status = "success"
state.postingList = action.payload.postingList
})
[...]
}