title: How can I upload image to the database using react hooks, redux?
body: <p>How can upload image using redux and react-hooks?</p>
  <ol>
  <li><p>Im already create handler for input[e.target.name]: e.target.value but I want to add
  create a handler for image but It cant recognize if it is file or not?</p>
  <pre><code>const onChange = e =&gt; {
  
   const imageFile = e.target.files[0]
   console.log(imageFile)
  
   setPetData({ ...petData, [e.target.name]: e.target.value})
  
  }
  </code></pre>
  </li>
  <li><p>With my input file petImage</p>
   
     
          onChange(e) } 
        />
         
  <pre><code>     &lt;span className=&quot;file-icon&quot;&gt;
          &lt;i className=&quot;fas fa-upload&quot;&gt;&lt;/i&gt;
       &lt;/span&gt;
  
       &lt;span className=&quot;file-label&quot;&gt;
         Upload Image
       &lt;/span&gt;
  
     &lt;/span&gt;
  
     &lt;span className=&quot;file-name&quot;&gt;
        {petImage}
     &lt;/span&gt;
  </code></pre>
    
   
  </li>
  <li><p>My Declaration on top with the using redux action <strong>[petRegister]</strong></p>
  <p>import React, { Fragment, useState } from 'react'</p>
  <p>import PropTypes from &quot;prop-types&quot;;</p>
  <p>import  { connect }  from 'react-redux'</p>
  <p>import { petRegister } from '../../actions/petActions'</p>
  </li>
  </ol>
  <p>Can I <strong>add another handler for file like e.target.files[0]</strong> ?</p>
  <p>Thank you very much?</p>