-3

I am new to react.js and JS in general. I am looking for an example of code that:

  1. uses react functions, not classes.
  2. let the user upload an image using
  3. then display that image on the screen

Thanks in advance.

OshNyc
  • 11
  • 1
  • Does this answer your question? [How do I reference a local image in React?](https://stackoverflow.com/questions/39999367/how-do-i-reference-a-local-image-in-react) – Ravi Makwana Feb 10 '20 at 07:48
  • 1
    Well well well....People here **can** help you but you have to help us with tried code which failed. Otherwise you can take a tour to _how to ask...?_ and Welcome to SO...:) – Jai Feb 10 '20 at 07:49
  • By using react hooks. – Aminadav Glickshtein Feb 10 '20 at 07:49
  • I'm afraid your question is hard to answer in a single post. It is quite complex. You will need a backend that supports file upload/storage. You could take a look on firebase for this. https://firebase.google.com/docs/storage/web/upload-files – Peter Ambruzs Feb 10 '20 at 07:57

1 Answers1

1

First image should copy in to project path and import that into your page

import img from "../../assets/img/logo.svg";

    render() {
        return (
                <div className="content" >
                     <img id="logo-img" src={img} alt="logo" />
                   </div>
                )
             }

Oshini
  • 613
  • 4
  • 17