Reactjs – useEffect hook can't set the state of product first time using the setProduct() method
import React, { useEffect, useState } from "react"; import { getParticularProduct } from "../services/productService"; import { Link, useParams } from "react-router-dom"; function ParicularProduct() { const [product, setProduct] = useState({}); const { id } = useParams(); useEffect(() => { try {…