标签:str his ace ext pre absolute sep rgb 上层
一、基础组件
export interface BaseProps { name: string; } export interface BaseState { age: number; } export class BaseComp<P extends BaseProps = any, S extends BaseState = any> extends React.Component<P, S> { state = { name: ‘123‘, } as S; }
二、上层组件
interface BetterProps extends BaseProps { gender: ‘man‘ | ‘female‘; } interface BetterState extends BaseState { language: string; } class BetterComp extends BaseComp<BetterProps, BetterState> { state = { ...this.state, language: ‘中文‘, } }
标签:str his ace ext pre absolute sep rgb 上层
原文地址:https://www.cnblogs.com/amiezhang/p/14395922.html