score:3
You are dispatching action creator functions not the actions
The increment and decrement functions are called action creators. They return the action object.
You should call the action creator function for dispatching an action.
<button onClick={() => dispatch(**increment()**)}>+</button>
score:0
That problem is solved by using a middleware like redux-thunk
or saga
in the store
configuration.
import { createStore, applyMiddleware } from "redux";
import rootReducer from "../reducers";
import thunk from "redux-thunk";
//Applying redux-thunk solves the problem
//Actions must be plain objects. Use custom middleware for async actions.
export const store = createStore(rootReducer, applyMiddleware(thunk));
score:3
In Redux, actions are objects. You have to execute actions functions into dispatch: dispatch(increment)
could be dispatch(increment())
Source: stackoverflow.com
Related Query
- Redux Error Actions must be plain objects. Use custom middleware for async actions
- React Redux Saga: Actions must be plain objects. Use custom middleware for async actions
- Redux thunk - Error ยท Actions must be plain objects. Use custom middleware for async actions even with dispatch an object with key type
- react & redux with hooks: Actions must be plain objects. Use custom middleware for async actions
- React redux Actions must be plain objects. Use custom middleware for async actions
- React-Redux: Actions must be plain objects. Use custom middleware for async actions Error
- Redux Actions must be plain objects. Use custom middleware for async actions
- Redux error: Actions must be plain objects. Use custom middleware for async actions
- Problem with redux middleware - Error: Actions must be plain objects. Use custom middleware for async actions
- I'm using a useDispatch custom hook and getting this error in my test: Actions must be plain objects. Use custom middleware for async actions
- Error: Actions must be plain objects. Use custom middleware for async actions. React-redux error
- Async Action Redux Unhandled Rejection (Error): Actions must be plain objects. Use custom middleware for async actions
- Error server Error: Actions must be plain objects. Use custom middleware for async actions
- Use custom middleware for async actions. Actions must be plain objects
- Error - Actions must be plain objects. Use custom middleware for async actions
- what is this error message for ? Actions must be plain objects. Use custom middleware for async actions
- React-Redux: Actions must be plain objects. Use custom middleware for async actions
- Unit test: Actions must be plain objects. Use custom middleware for async actions
- CreateAsyncThunk Error: Actions must be plain objects. Use custom middleware for async actions
- React-Redux-Saga: Actions must be plain objects. Use custom middleware for async actions
- React-Redux - Unhandled Rejection (Error): Actions must be plain objects. Use custom middleware for async actions
- Actions must be plain objects. Use custom middleware for async actions.how to solve this
- react-redux Error: Actions must be plain objects. Use custom middleware for async actions
- redux-observable + socket.io: Actions must be plain objects. Use custom middleware for async actions
- Error: Actions must be plain objects. Use custom middleware for async actions.
- Actions must be plain objects. Use custom middleware for async actions - Lost Here
- Actions must be plain objects. Use custom middleware for async actions
- How to fix: Error: Actions must be plain objects. Use custom middleware for async actions.?
- Redux-Thunk Error: Actions must be plain objects. Use custom middleware for async actions
- Error: Actions must be plain objects. Use custom middleware for async actions. But I don`t have async functions
More Query from same tag
- How can i set content type multipart form data in axios
- using jest, how to console log the value of text input?
- How to fix position of one element in a flexbox?
- Monitoring multiple server stats in React JS
- Why my slider don't work properly backwards
- Yield call timeout after 60 seconds when calling api in React Redux-Saga
- onKeyDown not firing on component
- How do you save/post using axios correctly
- how to change display property of a component after transition ends?
- React/Rebase/Firebase warning: Permission Denied - How do I add user authentication?
- Msal logout displaying multiple account
- Where does useSelector Pull State from if it is Not Passed In?
- MapDispatchToProps returns a function
- Missing sourcemaps in Typescript + Webpack project
- displaying a sucess message using email.js
- Filter array with checkbox and input react
- Serving up a single page rect app using java vert.x web server
- Print the value of focused input in reactJs
- React useState variable resets to True when I access it
- How can I add "editable cell" for grouped columns in Ant Design?
- Infinite calls in axios.get
- Why does this function variable have initial values?
- Set loading state before and after an action in a React class component
- how to convert class component to function component with hooks in reactjs
- Pass values from a Form to another component
- How to add multiple dynamic styles to a React component?
- How to prevent converting 0.00 to 0.0 by prettier eslint automatically
- How to change element when one of objects in array has status "Confirmed"?
- Is there any way to get a profile of owner of shopify account or app or store?
- Redux : reset 1 variable to initial state in Redux