I cant’t find a path for the image React styled components. The path is correct I think, could it be the styled-components issue ?
https://codesandbox.io/s/soirees-ll0ehp?file=/src/App.js:120-698
import styled from "styled-components";
export default function App() {
const Main = styled.div`
height: 100vh;
background: center / cover no-repeat url("./assets/main.jpg");
background-color: grey;
background-image: url("../src/assets/main.jpg");
`;
const FindPicsWrapper = styled.div`
position: absolute;
top: 60vh;
left: 50%;
transform: translateX(-50%);
`;
return (
<div className="App">
<Main>
<Header />
<FindPicsWrapper>
<FindPics />
</FindPicsWrapper>
</Main>
</div>
);
}
>Solution :
you have to use:
import img from './assets/main.jpg';
then use it as:
url(${img})