I am not understanding how import works in React. I'm currently using create-react-app
. I have a folder inside components folder named images
:
- src
- components
- images
Insides the components folder I also have a js file named ProductSquare.js
.
I am trying to import a picture from images folder using this line
import bumper from './images/bumper1.png';
I have tried changing it to only bumper1.png
and many other options. What am I doing wrong here? ( would appreciate a better way to do it in the future).
Is this how programmers import pictures in the real world?