Background image with Styled-Components in React invalid path?

Asked

Viewed 366 times

0

I’m trying to use an image as the background of a page in a React project, I thought to import with styled-components but I did not succeed, follows a print where the picture is, and what I tried to call:

Localizar e importar imagem corretamente

  • what happens?

  • says address not found

  • Understood the answer?

  • I got it, it worked, thanks!!

1 answer

0


Your address is really wrong, the folder src (which means source) is your root folder, ie, get from that folder reading all the code and related files so that your app work, then change:

.src/img/fundo.jpg

for

./img/fundo.jpg

the rest of the code remains the same, so actually the path is invalid.

  • 1

    thank you! now was!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.