survivejs / webpack-book

From apprentice to master (CC BY-NC-ND)
https://survivejs.com/webpack/
2.42k stars 319 forks source link

React.createElement: type should not be null, undefined, boolean, or number. #102

Closed will-iknow-dev closed 8 years ago

will-iknow-dev commented 8 years ago

Hi I am getting this error when trying to create a new note, I even get the error when add lanes. I am in chapter 6 of the book adding notes to lane. I have my code is located here: https://github.com/will-iknow-dev/kanban.

bebraw commented 8 years ago

Hi,

Check out components/lanes.js. You have lines like these there:

<Lane.Header name={lane.name} />
<Lane.Notes notes={lane.notes} />

The problem is that both Lane.Header and Lane.Notes evaluate as undefined. That's what the error is telling.

You can get better debug output by changing the component format to something like this:

import React from 'react';
import Lane from './Lane.js';

const Lanes = ({lanes}) => {
    return (
        <div className="lanes">{lanes.map(lane =>
            <Lane className="lane" key={lane.id} lane={lane}>
                <Lane.Header name={lane.name} />
                <Lane.Notes notes={lane.notes} />
            </Lane>
            )}</div>
        );
}

export default Lanes;

Then you can see Lanes in the error message. I'll change this in the next release.

If you are unsure of something, check out the source code in this repository or connect with me at the chat. đź‘Ť

will-iknow-dev commented 8 years ago

Where is the code so that I can compare because I am getting lane in the error and it's telling me to check my rendering method but I'm confused at what I may have done wrong with the rendering.

On Thu, Sep 1, 2016 at 10:32 AM, Juho Vepsäläinen notifications@github.com wrote:

Hi,

Check out components/lanes.js. You have lines like these there:

The problem is that both Lane.Header and Lane.Notes evaluate as undefined. That's what the error is telling.

You can get better debug output by changing the component format to something like this:

import React from 'react';import Lane from './Lane.js'; const Lanes = ({lanes}) => { return (

{lanes.map(lane => )}
    );

} export default Lanes;

Then you can see Lanes in the error message. I'll change this in the next release.

If you are unsure of something, check out the source code in this repository or connect with me at the chat https://gitter.im/survivejs/react. đź‘Ť

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/survivejs/webpack/issues/102#issuecomment-244097555, or mute the thread https://github.com/notifications/unsubscribe-auth/ALraEq8b3--SlbLlauBN3MXwfy3wHZfEks5qluHlgaJpZM4Jyulz .

Will Bean Front-End Developer I Know Development Solutions 267-639-1229 will.bean@iknowdev.com

"It is not the strongest of the species that survive, nor the most intelligent, but the one most responsive to change" – Charles Darwin

bebraw commented 8 years ago

Hi,

I have the source of that part of the book here. I hope that helps!