How to set a background image in reactjs?

You need to store your images in the public folder of your project. You can refer to the public folder using a forward slash / and access your images from there.

For example:

<img src="/background.jpg" />

You can do the same in a CSS File:

.background {
   background-image: url("/background.jpg");
}

Leave a Comment

File not found.