Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components)

For newbies you may experience warning catch by chrome developer tool that you might take few hours to resolve it and hard to find reason behind why it happened when using ReactJS. Code level seems to be nothing wrong with extremely simple code.

Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components).

react-error-code

Download full codebase with error

Root Caused:┬áSystem throw warning and not displaying “Hello, world! I am a CommentList” due to┬áCommentList component load after CommentBox component.

Resolution: Just move CommentList component script before CommentBox will resolve this warning.

Result:

react-error-code-rendering

Download full codebase without error

1 Comment

  • Sophia Feng

    February 4, 2016 at 9:48 pm

    Thanks!!!! I am new to React. I was working through the Facebook React tutorial and got this error. Yes it was due to the order of component code blocks. Wouldn’t think this will cause a problem as I’ve been so used to Python’s style.

Post a Comment