Reputation: 1055
I'm trying to apply a backgroundImage but it's not finding my local path url.
I try:
import { makeStyles } from '@material-ui/core/styles';
const loginWrapperStyles = makeStyles(theme => ({
image: {
backgroundImage: 'url(../../../public/assets/regbackground.jpg)',
}}))
If i use the import as a test to find the assets folder, they say this is the correct path:
This is the exactly name/format of the image:
What i'm doing wrong? My image is not rendering.
Upvotes: 0
Views: 147
Reputation: 450
Try this
import { makeStyles } from '@material-ui/core/styles';
import image from '../../../public/assets/regbackground.jpg'
const loginWrapperStyles = makeStyles(theme => ({
image: {
backgroundImage: `url(${image})`,
}}))
Upvotes: 1