0
点赞
收藏
分享

微信扫一扫

typescript react 相关问题(持续更新)

深夜瞎琢磨 2021-09-25 阅读 57
日记本

1、inputchange 写回调方法时候的type


要用React.ChangeEvent<HTMLInputElement>
2、


声明state时候用useState没有声明变量类型,当调用set时候就会报错Type 'string' is not assignable to type 'never'.
需要在声明的时候const [pictures, setPictures] = useState<string[]>([]);
3、类型转换

 const address = JSON.parse(addressString) as AddressById_addressById;
举报

相关推荐

0 条评论