React
奋斗的吧小菜鸟
这个作者很懒,什么都没留下…
展开
-
TS2739 Type is missing the following properties from type Readonly history location match
工程中报如下错误:解决方案:引入 withRouter,将组件包裹目的就是让被修饰的组件可以从属性中获取history,location,match,路由组件可以直接获取这些属性,而非路由组件就必须通过withRouter修饰后才能获取这些属性了...原创 2019-12-02 16:37:20 · 9265 阅读 · 0 评论 -
react 中的 setState 的异步执行
react 中的 setSate 方法是异步的,它的写法有两种形式:1、参数为一个对象this.setState({ love: '甜甜', foot: '火锅、串串'})2、参数为一个方法this.setState(()=>{ return { love: '甜甜', foot: '火锅、串串' }})...原创 2019-07-14 10:33:45 · 908 阅读 · 0 评论