键入没有道具的React组件类的正确方法是什么?

根据定义,React项目中的顶级组件不会有任何道具传递给它。在使用Typescript时,正确的输入方式是什么?

我最近一直在使用下面的模型,但也许有一种更简单的方法?

interface AppState {
    ...
}
class App extends React.Component<{},AppState> {
    constructor(props: never) {
        super(props);
        this.state = {
            ...
        }
        ...
    }
    ...
}

转载请注明出处:http://www.dlaisen.com/article/20230526/1165238.html