Open ytxbnahn opened 6 years ago
在使用新的布局方式vw之后引入了cssnano,
导致keyframes的名字变成了a,组件之间发生了冲突
解决方案 cssnano({ preset: "advanced", autoprefixer: false, reduceIdents: false, "postcss-zindex": false })
参考链接
在使用Link是出现错误 Invariant Violation: React.Children.only expected to receive a single React element child.
<Link to="/home">
<div>hello</div>
</Link>
长列表渲染优化方案
组件异步加载方案
build之后registerServiceWorker问题
具体原因不明但是问题解决,服务器需要https才可以 目前解决:删除 参考链接https://stackoverflow.com/questions/34290337/serviceworker-registration-failed-domexception-only-secure-origins-are-allowed
build router错误
目前解决:
import { HashRouter as Router, Route } from 'react-router-dom
import createHistory from 'history/createHashHistory
const history = createHistory()
`const RouteConfig = ()
link :
index` 参考链接https://www.cnblogs.com/fengnovo/p/6951533.htmlTypeError: middleware is not a function
在使用redux的异步操作时,参考教程http://cn.redux.js.org/docs/advanced/ExampleRedditAPI.html 但在运行时报上述错误,最终解决参考https://github.com/gaearon/redux-thunk/issues/35 具体原因:不详 中间件原理不懂
less使用
参考链接:https://ant.design/docs/react/use-with-create-react-app-cn 补充: 需加载npm install less --sava --dev
link 跳转
无法再router控件外添加
redux使用问题
在render中不小心调用了 action中的方法 进入了无限循环 理解: 渲染页面,触发方法,方法介绍渲染页面进入循环
this.setState异步问题
解决:
this.setState({
state: data
}, () => {
console.log('回调')
});
参考链接https://segmentfault.com/a/1190000008051628ios react的click问题
参考链接https://github.com/JakeSidSmith/react-fastclick
react的components建立索引
写法
export { default as Swiper } from './swiper/index';
export { default as ShareMask } from './ShareMask/index';