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 = () => {}
posted @ 2022-02-25 17:17  有只橘猫  阅读(1503)  评论(0编辑  收藏  举报