redux.js:275 Uncaught Error: Actions must be plain objects. Instead, the actual type was: ‘function‘
import store from './store'
import { AUGMENT, SUBTRACT } from './antistop'
export const augment = (data) => ({ type: AUGMENT, data })
export const subtract = (data) => ({ type: SUBTRACT, data })
// 异步定义的方法 action
// store直接接收对象 异步传的是一个方法是不对的
export const settienbgj = (data, varf) => {
return () => {
setTimeout(() => {
store.dispatch(augment(data))
}, varf)
}
}
store直接接收对象 异步传的是一个方法是不对的
需要安装 redux-thunk
npm add redux-thunk