bla
bla

Reputation: 1055

backgroundImage is not finding my url path

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:

enter image description here

This is the exactly name/format of the image:

enter image description here

What i'm doing wrong? My image is not rendering.

Upvotes: 0

Views: 147

Answers (1)

Alexfrostwolf
Alexfrostwolf

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

Related Questions