I get a compile error when I try to handle the file choose event for the input
const onChangeHandler = (e: React.ChangeEvent<HTMLInputElement>) => { const newValue = e.currentTarget.files; onChange(newValue.length ? newValue : undefined, e);};return (<div className={clNames}><input name={name} type="file" accept={extension} multiple={multiple} onChange={onChangeHandler} /></div>);
I get the following error:
TS2531: Object is possibly 'null'.TS2345: Argument of type 'FileList | null | undefined' is not assignable to parameter of type 'string | undefined'.
I am very new to React, could you please help me?