老师为什么泛型languageState用逗号,WithTranslation却用&呢
来源:8-7 【i18n】完成网站语言切换

你不懂我胖虎
2021-01-19
写回答
2回答
-
React.Component的范型接受两个参数,
React.Component<Props,State>
第一个参数是组件的props类型,第二个参数是组件的State,与函数一样,范型参数之间使用逗号。
使用&操作符表示 and 操作,如果代码这样写,是不是就理解了?
type Props = RouteComponentProps & WithTranslation class HeaderComponent extends React.Component<Props, LanguageState>
312021-01-20 -
你不懂我胖虎
提问者
2021-01-19
class HeaderComponent extends React.Component<RouteComponentProps & WithTranslation, LanguageState>
代码是这样的
00
相似问题