2017-06-15 57 views
0

任何人都可以提供有關從Redux-Logger過濾動作的提示嗎?我試圖過濾來自Redux Form的@@redux-form/BLUR之類的東西。於終極版記錄儀食譜這裏https://github.com/evgenyrodionov/redux-logger#log-everything-except-actions-with-certain-type使用Predicate選項過濾redux-logger中的redux-form動作

Log everything except actions with certain type 

createLogger({ 
    predicate: (getState, action) => action.type !== AUTH_REMOVE_TOKEN 
}); 

基於上述引用我希望爲用戶提供類似格式化表達的語句,並返回false配方

爲主。我正在成功傳遞摺疊選項,所以我不會懷疑我在applyMiddlewear()中做了什麼錯誤。

predicate:(getState, action) => action.type !== @@redux-form/FOCUS || @@redux-form/BLUR || @@redux-form/FOCUS 

回答

1

從終極版記錄儀的創建者:

predicate:(getState, action) => !action.type.includes('@@redux-form') 

全部實施例:

import { applyMiddleware, createStore } from 'redux'; 
import { createLogger } from 'redux-logger'; 

const logger = createLogger({ 
    predicate: (getState, action) => !action.type.includes('@@redux-form'), 

    //...other options 
}); 

const store = createStore(
    reducer, 
    applyMiddleware(logger) 
);