ReactJS background-image not working


Hello y’all. I’m building a ‘dummy’ website to train and consolidate my reactJS skills. My goal is to display a background-Image. On the first Image, i’m setting it inline and on the second one, i’m using conventional css but neither of them can display my image. So enlighten me. what am i doing wrong ? how can i fix it ?

Is it possible you have one too many ../'s?

1 Like

I transferred the image into my public folder to have a much simpler path but is still doesn’t work. and the initial path is correct actually…

In your first screenshot, you are trying to style a Fragment.

Unless I am mistaken, you can only provide a key attribute to a Fragment.

From the old documentation:

key is the only attribute that can be passed to Fragment. In the future, we may add support for additional attributes, such as event handlers.

You could use a div instead.

1 Like

it worked !!! i know now the limitations of working with Fragments. Thank you for your response @mtrtmk. :muscle:t6:

1 Like