title: Reset file upload after useState react js hooks
body: <p>I wanted to reset my file upload control after I add selected image to array with useState hooks, but it is not somehow working for me.</p>
  <p>My Code -</p>
  <pre><code>const fileInputRef = useRef();
  const[images,setImages]=useState([]);
  
  const addImage = (e)=&gt;{
   setImages([...images,e.target.files])
  }
  
  
  useEffect(()=&gt;{
  if(fileInputRef) fileInputRef.current.value=null
   },[images])
  
  return( &lt;input type=&quot;file&quot; ref={fileInputRef} onChange={addImage} /&gt;)
  </code></pre>
  <p>Now here fileInputRef is reset, but the problem here is I am getting images array with FileList object as length 0 as shown in the image below</p>
  <p><a href="https://i.stack.imgur.com/RUzZx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RUzZx.png" alt="enter image description here" /></a>.</p>
  <p>Please help.</p>