Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
PNG not showing in react tsx page with no errors

I am using this starter template (https://github.com/vikpe/react-webpack-typescript-starter).

I'm also using react-bootstrap, and have a container with a backgroundImage.

const heroImage = require("./../assets/img/hero.png").default;

const styles = {
  hero: {
    height: "100vh",
    display: "flex", 
    justifyContent: "center",
    alignItems: "center",
    backgroundImage: "url(${heroImage})",
    backgroundPosition: 'center',
    backgroundSize: 'cover',
    backgroundRepeat: 'no-repeat'
  },
  nav: {
    width: "100%"
  }
};

<Container fluid style={styles.hero}>
</Container>

I also print the image to make sure the link that returns shows me the image, which it does.

console.log(heroImage);

But for some reason, the image simply doesn't show. The background is blank with no errors.

What's going on here?

Thank you.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You are using double quotes(") instead of backtick (`) in the backgroundImage

should be

backgroundImage: `url(${heroImage})`,
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!