1

I want to use a React-Table with a lot of data.

Here is my data:

myData: {Array1:[{},{},...], Array2:[{},{},...], Array3:[{},{},...]}

So in my React-Table component, I do this:

<ReactTableFixedColumns data={myData} />

but it is not working. If I do *"data={myData.Array1}"*, I can see my data present in Array1. But I want to have all my data, not only the data in Array1.

2
  • If the data in the arrays are all of the same format then you should combine them into one array and pass it to the table. Commented Oct 11, 2019 at 9:03
  • The data in the arrays are not all of the same format Commented Oct 11, 2019 at 9:08

1 Answer 1

4

You can combine all the data into one array:

const data = Object.values(myData).flatMap(arr => arr)

<ReactTableFixedColumns data={data} />
Sign up to request clarification or add additional context in comments.

4 Comments

@Gargantua this is nice answer, what did you exactly want?
@SuleymanSah Because, My array1 as 30 data. All arrays combined equals to 100 data. So, my table have 100 row, not the 30 I need
@Gargantua you said You wanted to have all data, not only the data in "Array1"
Yes, your solution work (sorry for the late answer)

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.