Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

268
Views
Uncaught TypeError: product is undefined Can't access my product user id Uncaught TypeError: Cannot read properties of undefined (reading '_id')

Am trying to set a link depending on what if a user created the post or not if he did creaedt it then an EDIT button appear else a report on does

        const userLogin = useSelector((state) => state.userLogin)
        const { userInfo } = userLogin
    
        const productDetails = useSelector (state => state.productDetails)

const {loading, error, product} = productDetails

            useEffect(() => {
                dispatch(listProductDetails(id))
                dispatch(listProducts())
        
              }, [dispatch, id])
        
              const [bid, setBid] = useState('')
        
        
              const submitHandler =(e) => {
                e.preventDefault()
                if (setBid > product.currentPrice + product.minIncrement){
                  dispatch(makeBid({bid, _id: id}))
                }else {
                  console.log("Bid isn't big enough")
                }
              }    
        
            return (
            <>
                <Link className='btn btn-dark my-3' to='/'>more</Link>
                   
        

the problem is here i can't access my data

{userInfo ?(userInfo.id===product._id&&(
                <Link className='ml-19' to={`/product/${product._id}/edit`}>EDIT</L`enter code here`ink>
                ))
                :userInfo?(userInfo.id !== product._id&&(
                  <Link to={`/product/${product._id}/report`}>REPORT</Link>
                )):
                
                (<></>)}
                {loading ? <Loader /> : error ? <Message variant='danger'>{error}</Message> 
                : (        
                  
                    <>
                    <Meta title={product.name} />
                    <Row>
                    <Col md={4} >
                        <Link className='link' to={`/profile/${product._id}`}>
                               <h5>Listing created by</h5> <h6>{/*product.user.name*/}</h6>
                        </Link>
                        <Image className='border border-primary' src={product.image} alt={product.name} fluid/>
               ....
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!