react的类组件的ts写法
react的类组件的ts写法,声明的变量,props和state的写法
import React, { PureComponent } from 'react';
interface Iprops {
infoType: number | string,
title: string,
type?: string | number,
isNew?: any,
id?: any
}
interface Istate {
model: any,
loading: boolean,
}
class SocietyAppraiseDetail extends PureComponent<Iprops, Istate> {
constructor(props: Iprops) {
super(props)
this.state = {
loading: false,
model: {},
};
}
componentDidMount() {
this.setState({ loading: true });
this.initProcess();
}
initProcess = () => {}