<div class="burger">
<div class="menu">
</div>
const { product, contextFindItem, contextRemoveItem, contextPushItem } = useGlobalContext();
const [like, setLike] = useState<boolean | null>(null);
const [buy, setBuy] = useState<boolean | null>(null);
let navigate = useNavigate();
useEffect(() => {
if (product === null) {
navigate('/');
} else {
setLike(contextFindItem('likes', product.personalKey) ? false : true);
setBuy(contextFindItem('basket', product!.personalKey) ? false : true);
}
}, [])
xport const ProductPage = () => {
const { product, contextFindItem, contextRemoveItem, contextPushItem } = useGlobalContext();
const [like, setLike] = useState<boolean | null>(null);
const [buy, setBuy] = useState<boolean | null>(null);
useEffect(() => {
if (product === null) {
<Navigate to="/" />
} else {
setLike(contextFindItem('likes', product.personalKey) ? false : true);
setBuy(contextFindItem('basket', product!.personalKey) ? false : true);
}
}, [product])
return (
//jsx использует product
)
}