I was trying to figure out React deeper and stuck on this error. It didn't allow me to dispatch any actions. However, I'm not using async at all. Here you can find codesandbox of the full app.
I've added thunkMiddleware to the store, so the app will work.
However I can't understand what is going on?
Here are the action creators, inside which I cloudn't dispatch. I've searched for different similar answers, and all those were connected to incorrect usage of async actions. Mine are sync:
import CART_ACTIONS from "../action_types/cartActionTypes";
function addToCart(item) {
return dispatch => dispatch({ type: CART_ACTIONS.ADD_ITEM, item: item });
}
function removeFromCart(item) {
return dispatch => {
dispatch({ type: CART_ACTIONS.REMOVE_ITEM, item });
};
}
function clearCart(item) {
return dispatch => {
dispatch({ type: CART_ACTIONS.CLEAR_CART });
};
}
export const cartActions = { addToCart, removeFromCart, clearCart };