Skip to content

why i am getting error for this one like Unexpected template string expression no-template-curly-in-string

 <Card className='my-3 p-3 rounded'>
  <a href={'/product/${product._id}'}>
    <Card.Img src={product.image} variant='top' />
  </a>
</Card>

here i am posting my code i am getting the error while running npm start Unexpected template string expression no-template-curly-in-string

Answer

You should replace quotes (') to a backtick quotes (`) at your href inside <a> tag like this.

Before:

<a href={'/product/${product._id}'}>

After:

<a href={`/product/${product._id}`}>

Here is link to eslint doc page for more information.