ytxbnahn / ytxbnahn.github.io

1 stars 0 forks source link

react 学习笔记 #6

Open ytxbnahn opened 7 years ago

ytxbnahn commented 7 years ago

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.html

TypeError: 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/1190000008051628

aermin commented 6 years ago

请问build之后registerServiceWorker问题的解决方案是删除啥呢??怎么解决