preact:OnChange 不适用于输入文件

preact: OnChange doesn't work with input files

我遇到了 preact 中的 onChange 事件不起作用的问题。在 react 中一切正常。 onInput 也不行。

必须有效的哑代码示例 (preact + typescript)

export class Download extends React.Component<DownloadProps, {}> {
  constructor(props: DownloadProps) {
    super(props);
    this.state = {
      imgSrc: ''
    };
  }

  public componentDidUpdate() {
    console.log('did2')
  }
    public render() {
      console.log('render', this.state);
      return <div className={s.root}>
        <input className='fileInput' type='file' onChange={() => { this.handleImageChange() }}  />
        <div className={s.comment}>Upload</div>
      </div>;
    }

  private handleImageChange() {
      this.setState({imgSrc: '30'})
    }
}

这已在 2 天前发布的 preact-compat 3.13.1 中修复:

https://github.com/developit/preact-compat/releases/tag/3.13.1