试试这个:
class Main extends React.Component<MainProps, MainState> {
constructor(props) {
super(props);
this.state = { todos: [], editorState: EditorState.createEmpty() };
this.onChange = (editorState) => this.setState({ editorState });
}
onChange: (state: MainState) => void;
}
我还没有测试过,但是我认为它应该可以工作。