Home > Software engineering >  Why my string interpolation is not working with URL?
Why my string interpolation is not working with URL?

Time:10-17

I am making a react app and my string interpolation is not working. It's a bit strange because it is not working in URL or links. I am trying to complete a link here but I tried to check using a variable and it is working otherwise but not in links. I am having issue with ${number} part in backgroundImage Can anyone help with this as I am stuck?This is the snippet of the code where I am having issue

CodePudding user response:

You're missing backticks around the string you're trying to interpolate

Wrap this string: URL('....${number})' in backticks, backtick: `

  • Related