숙제를 따라했는데 계속 에러가 뜨네요 왜 그럴까요?ㅜㅜ
Uncaught TypeError: Cannot read properties of undefined (reading 'title')
at Detail (Detail.js:20:1)
import { useParams } from 'react-router-dom';
const Detail = (props) => {
let { id } = useParams();
let product = props.shoes.find( x => x.id === id);
console.log(product);
console.log(id);
return (
<div className="container">
<div className="row">
<div className="col-md-6">
<img
src="https://codingapple1.github.io/shop/shoes1.jpg"
width="100%"
alt=""
/>
</div>
<div className="col-md-6">
<h4 className="pt-5">{product.title}</h4>
<p>{product.content}</p>
<p>{product.price}</p>
<button className="btn btn-danger">주문하기</button>
</div>
</div>
</div>
);
};
export default Detail;