1.0.0 • Published 5 years ago

use-file-input v1.0.0

Weekly downloads
124
License
MIT
Repository
github
Last release
5 years ago

use-file-input

React Hooks for selecting files with hidden <input type="file" />

npm install --save use-file-input
# or
yarn add use-file-input

Usage

const Component = () => {
  const handleFileSelect = useFileInput(
    (files) => {
      // files is FileList
      // do something with selected files
    },
    { accept: "image/*", multiple: true }
  );

  return (
    <button onClick={handleFileSelect}>
      Select files
    </button>
  );
};

License

MIT License