为什么我会收到这样的错误,例如 Unexpected template string expression no-template-curly-in-string
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>
我在这里发布我的代码 我在 运行 npm start 时遇到错误
意外的模板字符串表达式 no-template-curly-in-string
您应该像这样在 <a>
标签内的 href 将引号 (')
替换为反引号 (`)
。
之前:
<a href={'/product/${product._id}'}>
之后:
<a href={`/product/${product._id}`}>
这里是 link eslint 文档页面以获取更多信息。
<Card className='my-3 p-3 rounded'>
<a href={'/product/${product._id}'}>
<Card.Img src={product.image} variant='top' />
</a>
</Card>
我在这里发布我的代码 我在 运行 npm start 时遇到错误 意外的模板字符串表达式 no-template-curly-in-string
您应该像这样在 <a>
标签内的 href 将引号 (')
替换为反引号 (`)
。
之前:
<a href={'/product/${product._id}'}>
之后:
<a href={`/product/${product._id}`}>
这里是 link eslint 文档页面以获取更多信息。