关于`const {t} = this.props`
来源:8-7 【i18n】完成网站语言切换

qq_慕用0227865
2021-07-23
TS 学的不是很好,
请问老师为什么这样定义就是个类型
而去掉{}
定义就是个值呢?
写回答
1回答
-
阿莱克斯刘
2021-07-29
请看你的问题中的第一章图片的第一行,因为HomePageComponent 继承于 React.Component,而React.Component的props则是通过泛型 WithTranslation 定义的,而“t”的定义则来源于WithTranslation。具体的详细信息,你可以control + 鼠标点击m打开WithTranslation的定义来查看。
00
相似问题