Benjamin Hughes
Benjamin Hughes

Reputation: 73

React/Node/Express/Webpack -A valid React element (or null) must be returned

link to source code: https://github.com/manster829/MernStackT

I keep getting the error message: Uncaught Error: BugTable.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.

I have no idea why, I thought this might have something to do with ES6 or my syntax, but I can't get it. Anyone have any ideas? Thanks :)

Upvotes: 1

Views: 109

Answers (1)

Turnipdabeets
Turnipdabeets

Reputation: 6005

This is kind of silly but you need to move you ( next to your return statement, otherwise you actually return undefined and break out of the function. When you don't have anything next to a return statement javascript assumes you mean to simply return ...

Try this in BugTable.js:

return (
      <div>The list of bugs as a table would come here.</div>
   );

Upvotes: 3

Related Questions