title: React JS: Upload Multiple Files
body: <p>I am writing a button component in React.js that allows the user to upload as many files as they want to the app. My problem is, I can only upload one file at a time with the following code:</p>
  <pre><code>  const handleClick = event =&gt; {
      setViewPath(['My Files']);
      hiddenFileInput.current.click();
    };
    // Call a function (passed as a prop from the parent component)
    // to handle the user-selected file
    const handleChange = event =&gt; {
      const fileUploaded = event.target.files[2];
      props.handleFile(fileUploaded);
    };
    return (
      &lt;&gt;
        &lt;Button className={classes.uploadButton}
        onClick={handleClick}&gt;
          +Upload File(s)
        &lt;/Button&gt;
        &lt;input
          type=&quot;file&quot;
          ref={hiddenFileInput}
          onChange={handleChange}
          style={{display: 'none'}}
        /&gt;
      &lt;/&gt;
    );
  </code></pre>
  <p>So the function &quot;const handleChange&quot; is what's responsible for uploading the actual file itself. Any ideas on how to make it so that it can upload as many files as the user pleases?</p>