I created a Slice using createSlice from redux toolkit and exported my action such as:
export const { myAction } = slice.actions;
I am trying to create a middleware to catch some action type:
import myAction from './reducers/mySlice'
const MyMiddleware = store => next => action => {
if (action.type === myAction.type) { //this doesn't work, myAction is a function
doSomething(action.payload);
}
return next(action);
};
I was wondering if it was possible to get the action type as a constant from the slice I created?