I have a working API. When I console log the Data shows, but when I try to render it on the page it does work.
I am using params also. But I have added the API in full.
Please help me
import React, { useState, useEffect, } from "react";
import {useParams} from 'react-router-dom';
function ProductDetail(param) {
const {id} = useParams();
useEffect(() => {
fetchItem();
}, []);
const [item, setItem] = useState({});
const fetchItem = async () => {
const fetchItem = await fetch(`https://fortnite-api.theapinetwork.com/item/get?id=087b55b4-b958-4dc3-8a4b-018fd54d12c4`
);
const item = await fetchItem.json();
console.log(item.data);
}
return (
<div className="containter productsDetails">
<h1>Product Detail
</h1>
</div>
);
}
export default ProductDetail;
