0

I have the following API :

{
  list_A: [ ],
  list_B: [ ],
  list_C: {},
}

How can I map the data to display the category from Redux state : list_A, list_B, list_C, and not the dates inside.

I used JSON.parse(listType) but it didn't work

  const listType = useSelector((state) => state.orderReducer);
  {listType.map((type) => console.log(type))}

Result: ERROR listType.map is not a function TypeError: listType.map is not a function

Thank you

1
  • Did you log listType? What is the actual value? Is it actually an array? Commented Apr 24, 2023 at 18:24

1 Answer 1

2

Is this what you are looking for?

const categories = {
  list_A: [],
  list_B: [],
  list_C: {},
}
console.log(Object.keys(categories))

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.