我遇到了redux logger的问题。 它什么都不做。没有错误没有日志,没有。 这是来源。
import { applyMiddleware, createStore } from 'redux';
import logger from 'redux-logger';
import thunk from 'redux-thunk';
import diffLogger from 'redux-diff-logger';
const middleware = applyMiddleware(thunk, logger);
import reducer from './reducers';
export default createStore(reducer, middleware);
此代码不记录任何内容。 我已经尝试了所有宣言选项。 这是我的package.json文件:
{
"name": "signup-form",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "./node_modules/.bin/webpack-dev-server --content-base src --inline --hot"
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.16.1",
"babel-core": "^6.24.1",
"node-sass": "^4.5.2",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"react-redux": "^5.0.4",
"redux": "^3.6.0",
"redux-diff-logger": "0.0.9",
"redux-logger": "^3.0.1",
"redux-promise-middleware": "^4.2.0",
"redux-thunk": "^2.2.0",
"sass-loader": "^6.0.3",
"style-loader": "^0.16.1"
},
"devDependencies": {
"babel-loader": "^6.2.0",
"babel-plugin-add-module-exports": "^0.1.2",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13",
"remote-redux-devtools": "^0.5.7",
"webpack": "^2.4.1",
"webpack-dev-server": "^2.4.2"
}
}
我在webpack 1和redux-logger 2上尝试过。完全使用略有不同的语法。
import logger from 'redux-logger';
const middleware = applyMiddleware(promise(), thunk, logger());
有人遇到过同样的问题吗? 感谢。