7

Since today morning we are getting below issue, After building latest node_modules :

**methods.js?ab36:59 Uncaught (in promise) TypeError: Cannot read property 'forEach' of undefined

at ReactTable.getDataModel (methods.js?ab36:59)

3
  • Full Error details : methods.js?ab36:59 Uncaught (in promise) TypeError: Cannot read property 'forEach' of undefined at ReactTable.getDataModel (methods.js?ab36:59) at ReactTable._class (lifecycle.js?aa71:18) at ReactTable._class (methods.js?ab36:27) at new ReactTable (index.js?370e:30) at constructClassInstance (VM376323 react-dom.development.js:14204) at updateClassComponent (VM376323 react-dom.development.js:18413) at beginWork$1 (VM376323 react-dom.development.js:20186) at HTMLUnknownElement.callCallback (VM376323 react-dom.development Commented Dec 4, 2019 at 14:55
  • 1
    Please edit the question with the full error details, including proper formatting. It's much easier to read that way. Commented Dec 4, 2019 at 14:57
  • show a piece of failed code Commented Dec 4, 2019 at 14:57

3 Answers 3

28

Example:

You should do something like this:

useTable({ columns, data: tableData }) // must be data
Sign up to request clarification or add additional context in comments.

1 Comment

We don't allow images of text (code/input/output/errors, or otherwise) on Stack Overflow. Please post your answer as (formatted) code only. To understand why, check out this post on the Meta Stack Overflow site. Though it focuses on the perspective of asking questions, it also applies to answers as well.
2

Look at this: https://github.com/tannerlinsley/react-table/issues/1686 and try a downgrade.

P.S. Please be more accurate on your questions

Comments

0

I had this error. In my case, the fix was much simpler than those suggested the above. React-table MUST be given a list. My fetch (GET request) was returning an object which I did not anticipate. React-table needs a list to iterate over, NOT an object. An array/list of objects is a list.

The fix was to use [ ] around the fetched object because this made it a list of a single object. React-table could then iterate over this list.

For example, React-table can't iterate over the following object:

{key1:pair1}

But it CAN iterate over this similar array containing one object, notice the square brackets:

[{key1:pair1}]

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

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.