0

Due to the licensing issue in ReactJS, we were forced to find an open source alternative. So we decided to use PreactJS which is a React alternative. After porting to Preact, we found that the onChange handler wasn't working on input element. Below is part of the code in my render function:

{
 (function () {
  if (node.fileType === 'dir') {
   return <li className="tip-item" onClick={comp.showUpload.bind(comp, refs)}>
    <form className='fileForm' style={{display: 'inline-block'}}>
        <input type="file" name="file" className="import-file-input" ref="fileUpload" onInput={comp.uploadFile.bind(comp,node, filePath)}/>
    </form>Upload</li>;
   }
 })()
}

Any help would be appreciated.

  • There is no `onChange` handler there, just `onInput`. Also curious what scared you off RE the Apache 2 licence? – Dominic Jan 20 '17 at 10:08
  • @DominicTobias onInput isn't getting fired as well. And it was a company wide decision to pull out of React. – Edwin Samuel Jonathan Jan 20 '17 at 10:12
  • I realize this question is a month old, but I just wanted to drop a note on here - an issue was filed in `preact-compat` to address `onChange` support for all input types, and it has since been fixed and released. – Jason Miller Feb 14 '17 at 15:19
  • 1
    @Jason Miller I see. Right now I'm using a bad workaround which is accessing the DOM element directly and forcing the event. Thanks for the heads up. I will update the Preact libraries and update this thread. – Edwin Samuel Jonathan Feb 15 '17 at 17:17

0 Answers0