When I first started to render images in a React application, I remember being mystified about why an image might have to be required instead of imported like a component. Below are some examples of different ways of displaying an image on a page with explanations of what works and what does not.
For a more theoretical overview of what the require
method does, you could start here:
Or to learn more about imports, you could go here:
To use images in a React application, I start out by making a directory called Images
in the src directory and then dragging and dropping image files from my computer into it. Then, when I want an image to appear in a particular place on the page, there are a few different options for getting it to show up.
#reactjs #programming #react #nodejs #javascript