-1
<Link to={'${oldUrl}/${id}'} >

Hi, I am using template literal in a react app link tag and it is showing below error message please tell if anyone knows how to add it correctly?

Unexpected template string expression no-template-curly-in-string

famo
  • 160
  • 1
  • 13

2 Answers2

1

Change your code to this

<Link to={`${oldUrl}/${id}`} >

And it should clear the error

0

Use backticks (`) for template literals, not quotes (') :

<Link to={`${oldUrl}/${id}`} >
Anis R.
  • 6,656
  • 2
  • 15
  • 37