1. 使用 redux 的异步 action 时浏览器报错:
Error: Actions must be plain objects. Use custom middleware for async actions.

【原因】没有添加 thunk 中间件
【解决方法】在入口文件中添加中间件,并在 createStore 时进行注册:
import thunkMiddleware from 'redux-thunk'
const createStoreWithMiddleware = applyMiddleware(loggerMiddleware, thunkMiddleware)(createStore)
2. ant design pro 开启 eslint 后出现大量 warning:
Line 1: Definition for rule 'jsx-a11y/href-no-hash' was not jsx-a11y/href-no-hash

【原因】airbnb 的插件 jsx-a11y 暂时不能使用v6版本。
【解决方案】降低 eslint-plugin-jsx-a11y 版本为 5.1.0
npm install eslint-plugin-jsx-a11y@5.1.0 --save-dev
【注】
1. 在 antd pro 上提 issure,给的回复是 update eslint,尝试过,无效。
2. google 上的解决方法是在 eslint 文件中添加规则:'jsx-a11y/href-no-hash': 'off' ,尝试过,无效。
3. 参考资料:eslint 结合webpack 在React环境下的使用
|