I have a simple shopping app that I made with react, react-router and bootstrap. I've got a form on a certain page where I can add a new product to the database.
There I can provide a name, description, category, and upload a product image.
The thing is when I upload an image through <input ="file">, I want to somehow get the absolute path of the image when I press open and store it inside the local state.
Till now my code is like this...
function Form() {
  const [imageUrl, setImageUrl] = useState("");
  // ... a bunch of code here
  return (
    <form style={styles.form}>
      // ... a bunch of code here
      <div className="form-group">
        <label htmlFor="image" className="form-label" style={styles.label}>
          Picture
        </label>
        <input className="form-control" type="file" id="image" required />
      </div>
      // ... a bunch of code here
    </form>
  )
}
I've tried this but that is for Jquery.
I'm new to React, so please be kind, and thanks in advance :)
 
     
    