【发布时间】:2021-05-19 23:52:15
【问题描述】:
我从教程中学习,想制作ProductScreen.js和Product.js,结果出现了这个警告,是什么问题?
product.js
import React from 'react'
import Rating from './Rating';
export default function Product(props) {
const {product} = props;
return (
<div key={product._id} className="card">
<a href= '/product/${product._id}'> // Line 9
<img className="medium" src={product.image} alt={product.name} />
</a>
<div className="card-body">
<a href='/product/${product._id}'> //Line 13
<h2>{product.name}</h2>
</a>
<Rating
rating={product.rating}
numReviews={product.numReviews}
></Rating>
<div className="price">{product.price}lv</div>
</div>
</div>
)
}
【问题讨论】:
-
看起来您对这些字符串使用了错误的引号字符。另外我认为你不需要周围的
{ }
标签: javascript node.js reactjs