TypeError: Cannot read properties of undefined (reading 'params')
5 | import products from '../products'
6 |
7 | function ProductScreen({ match }) {
8 | const product = products.find((p) => p._id == match.params.id)
9 | return (
10 | <div>
11 | {product.name}
Run Code Online (Sandbox Code Playgroud)
这是我的 ProductScreen.js 文件,导致出现问题
import React from 'react'
import { Link } from 'react-router-dom'
import { Row, Col, Image, ListGroup, Button, Card } from 'react-bootstrap'
import Rating from '../components/Rating' …Run Code Online (Sandbox Code Playgroud)