![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
React
一天不学习感觉像头猪
这个作者很懒,什么都没留下…
展开
-
React-router路由
1.页面跳转router,页面会重新渲染2.Hash router,类似页面跳转,只是跳转到hash指定的状态,页面不会重新刷新渲染3.H5 router,模拟路由的同时页面不跳转,既能操作hahs也能操作路径,不渲染不刷新(只处理后退,不处理前进)安装:yarn add react-router-dom可以加版本号react-router-dom@4.2.2示例:...原创 2019-11-16 20:53:40 · 74 阅读 · 0 评论 -
React生命周期
初始化数据:加载前执行构造函数:constructor正要加载时执行:componentWillMount (异步的方法可以放在这里)把dom渲染出来:render渲染完成执行:componentDidMount更新数据之后:将要接收父组件传来的props执行:componentWillReceiveProps子组件是否要更新:shouldComponentUpda...原创 2019-11-16 13:40:14 · 93 阅读 · 0 评论 -
React遇到的问题
1.安装问题安装yarn之后,无法再git上初始化项目,yarn init解决:在cmd上初始化就行了2.react-router刷新后报错react-router刷新后报错路径找不到,默认的exact 也失效解决办法:把BrowserHistory,换成HashRouter,问题解决但是又会出现新的问题,报错Warning: Hash history ca...原创 2019-11-13 23:51:47 · 141 阅读 · 0 评论 -
react搭建脚手架和上传到gitee
搭建脚手架:项目不需要的文件,可以安装vim .gitignore1.从gitee上拉下创建的项目git clone 项目路径2.初始化项目yarn init3.上传到gitee$ git add . //添加本地文件 git commit -m '备注' //写备注git push //上传到码云git push -u origin ...原创 2019-11-13 16:52:19 · 654 阅读 · 0 评论