Skip to content

Instantly share code, notes, and snippets.

@Mike1stver
Forked from barraponto/file-input.js
Created August 6, 2019 17:31
Show Gist options
  • Save Mike1stver/6a508d3897771b78e9157c6c7e7bca86 to your computer and use it in GitHub Desktop.
Save Mike1stver/6a508d3897771b78e9157c6c7e7bca86 to your computer and use it in GitHub Desktop.
import React from 'react';
const handleChange = (handler) => ({target: {files}}) =>
handler(files.length ? {file: files[0], name: files[0].name} : {});
export default ({
input: {onChange, onBlur, value: omitValue, ...inputProps},
meta: omitMeta,
...props
}) => (
<input type="file"
onChange={handleChange(onChange)} onBlur={handleChange(onBlur)}
{...inputProps} {...props} />
);
@Mike1stver
Copy link
Author

guidance to connect a inputFile to reduxForm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment