Getting below error for specific action functions:
Error · Actions must be plain objects. Use custom middleware for async actions
Below code works fine on my system but loging erros on bugsnag for different users.
React component file:
import React, { Fragment, useEffect, useState, useRef } from 'react';
import { useSelector, useDispatch } from 'react-redux';
const dispatch = useDispatch();
const handleTabs = tab => {
dispatch(resetActionType());
tabChanged(tab);
};
Action file:
export function resetActionType() {
return dispatch => {
dispatch({
type: 'RESET_ACTION_TYPE',
});
};
}
Checking different questions on SO I could understand this error comes when we don't use dispatch or type key in object returned in dispatch. But I am doing both of them.
Error is not happening on all machines/OS/browsers. Coming for a few users only.
What is wrong with the above code? Any guidance would be appreciated.
This is not happening for every action, so I guess configuration is fine.
UPDATE:
I am using redux thunk.