私はこのエラーを取得しています:なぜ「次へ」がreduxミドルウェアコードで定義されていないと言われていますか?ミドルウェアの次の方法は廃止予定ですか?
index.js?dadc:6Uncaught TypeError: next is not a function
は廃止ReactJSにミドルウェアが使用する次の方法であり、または私は間違ってそれを使用していますか?
引数なしでapplyMiddleware
に
logger()
の戻り値を渡しているので、働いていない
import { applyMiddleware, combineReducers , createStore } from 'redux';
const logger =(store) => (next) => (action) => {
console.log('middle-ware called');
next(action);
}
const reducer=(state ,action)=>{
if(action.type=='INC'){
console.log('a-----------------',action);
return state+action.payload;
}
else
return state; };
const store=createStore(reducer ,1 ,applyMiddleware(logger()));
store.subscribe(()=>{
console.log('store changed',store.getState()) });
store.dispatch({type :'INC' ,payload : 10}); store.dispatch({type :'INC' ,payload : 10});
についての詳細を読むことができますか? – martriay