const ProductScreen = ({ match }) => {
/api/products/${match.params.id}
const [product, setProduct] = useState({})
useEffect(() => {
const fetchProduct = async () => {
const { data } = await axios.get()
setProduct(data)
}
fetchProduct();
})
I'm using useEffect and axios to get the data from backend but the console keeps on showing me this error
TypeError: Cannot read properties of undefined (reading 'params')
Top comments (0)