Closed shojib116 closed 1 month ago
This is now working when I added another reducer to the store. don't know why it is behaving like this!
Yeah, honestly no idea why. Also surprised to see that particular error message - Redux 4.2 changed that error message to:
throw new Error(
`Actions must be plain objects. Instead, the actual type was: '${kindOf(
action
)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`
)
Yeah, honestly no idea why. Also surprised to see that particular error message - Redux 4.2 changed that error message to:
throw new Error( `Actions must be plain objects. Instead, the actual type was: '${kindOf( action )}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.` )
Could you please shed some light on this peculiar behaviour? why the error persists when there is only one reducer and vanishes when there are more than one?
Absolutely no idea, sorry :(
I am using @reduxjs/toolkit v2.2.6, redux v5.0.1 and react-redux v9.1.2
I've written the following code
when there's an error, I am getting the following error
Error: Actions must be plain objects. Use custom middleware for async actions.
I've used exactly the same code two days ago. it was working seamlessly there. (redux v4.2.1, @reduxjs/toolkit v2.2.6, react-redux v8.1.3) But, in this new project I am getting this error. I tried going back to the exact package version of the previous project. But still did not work. According to redux thunk documentation, If configureStore is used, the thunk middleware is already applied. then, why is this error appearing inconsistently?