这是我的商店配置:
const sagaMiddleware = createSagaMiddleware();
const configureStore = () => {
return {
...createStore(rootReducer,
applyMiddleware(sagaMiddleware)),
runSaga: sagaMiddleware.run(rootSaga)
};
};
export default configureStore;
动作:
export const getInvoicesAction = (payload) => ({
type: types.GET_INVOICES_REQUEST,
payload
});
我试图在反应组件中映射DispatchToPtops:
const mapDispatchToProps = dispatch=>{
return {
getInvoices: (query)=> dispatch(getInvoicesAction(query))
};
};
export default connect(mapStateToProps, mapDispatchToProps)(InvoicesPage);
然后调用function int componentDidMount:
export class InvoicesPage extends React.Component {
constructor() {
super();
}
componentDidMount() {
this.props.getInvoices('test');
}
然而,在控制台中,它说this.props.getInvoices is not a function
任何解决方案?