/use-file-dialog

Open file dialog without struggling with file input using useFileDialog react hook

Primary LanguageTypeScript

React useFileDialog hook

NPM

Open file dialog without struggling with file input using useFileDialog react hook.

Install

You can install use-file-dialog with NPM or Yarn.

npm install use-file-dialog
yarn add use-file-dialog

Usage

Here's how to use use-file-dialog:

import useFileDialog from "use-file-dialog";

function App() {
  const { files, openFileDialog } = useFileDialog();

  console.log(files);

  return (
    <button type='button' onClick={openFileDialog}>Choose file</button>
  );
}