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

187
Views
I used redux.. i dispatch data successfully. i try to get data other page. Its shows error like Uncaught TypeError: undefined (reading 'category')

my code .

import React from 'react'
import { useSelector } from 'react-redux';

export default function ProductDetail() {

    const product =  useSelector((state)=>state)
    const datas = product.allProducts.products.Data
    console.log('data',datas )
  return (
  )
}

this code executed correctly and gave correct output.. but i want const datas = product.allProducts.products.Data.category

when i try to get category data its shows error like Uncaught TypeError: Cannot read properties of undefined (reading 'category') .

my json data

"Data": {
        "banner": [
            {
                "BannerId": 1,
                "BannerImage": "image 10_1650873105.png",
                "BannerTitle": "product banner1",
                "BannerDescr": "The products with 50% offer1"
            }
        ],
        "category": [
            {
                "CatId": 23,
                "CatName": "laptop",
                "CatImage": "kari-shea-1SAnrIxw5OY-unsplash_1650877809.jpg"
            }
        ]
    }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I believe you need to provide name of slice to get the data out of it, i.e.

`const product =  useSelector((state)=>state.nameOfTheSlice)`

here is example from docs

If you can provide the details of you product slice that would help to tackle in details.

about 4 years ago · Juan Pablo Isaza Report
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!