Skip to content Skip to sidebar Skip to footer

React/redux Component Will Not Render

My component is not rendering and I am not getting any errors. I have been stuck on this error for a few hours now so I am looking for any advice! I am trying to get a data to disp

Solution 1:

I was able to re-create your project in a boilerplate template I have and was also able to re-create your issue.

In your index.js:

// components

import {IndexTimesheet} from'./app/components/indexTimesheet';

Should be this - no brackets around the component:

importIndexTimesheetfrom'./app/components/indexTimesheet';

This is an interesting problem because, as you say, it throws no errors...when you have it wrapped with the redux store and react-router.

If you were to simply do:

ReactDOM.render(<IndexTimesheet />, document.getElementById('root'));

This WILL throw an error:

warning.js:45Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (forDOM elements) or a ReactClass (for composite components).warning @ warning.js:45ReactElementValidator.createElement @ ReactElementValidator.js:221(anonymous function) @ index.js:37(anonymous function) @ index.js:39(anonymous function) @ index.js:40(anonymous function) @ bundle.js:1036__webpack_require__ @ bundle.js:556fn @ bundle.js:87(anonymous function) @ multi_main:3(anonymous function) @ bundle.js:586__webpack_require__ @ bundle.js:556(anonymous function) @ bundle.js:579(anonymous function) @ bundle.js:582
invariant.js:39UncaughtInvariantViolation: Elementtype is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

So somewhere that error is being swallowed by Redux/React-Router, I haven't dug into where. In future troubleshooting always try to simplify your problem. Make everything as bare-bones as possible and then build it until you get the error - I took off your redux store and react-router wrapping which was how I was able to uncover it.

Try it out and see to make sure it wasn't just on my build.

Post a Comment for "React/redux Component Will Not Render"