NietzscheProgrammer NietzscheProgrammer - 1 month ago 11
React JSX Question

Reactjs: Warning: React.createElement: type should not be null or undefined

this the full error


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


and this is all I have in this view

import React, { Component } from 'react';
import Router, {Link, RouteHandler} from 'react-router';
import { Grid, Row, Column, List, ListItem } from '../../components/Layout';
import { RaisedButton, Paper } from 'material-ui';

const videosInformation = {
time : 25,
gameId : 15665,
date : '12 10 2015',
gameName : "Black Jack"
};

export default class Home extends Component {

static contextTypes = {
router : React.PropTypes.func
}

render () {
return <Grid>
<Row>
<Column>
<Paper>
<List subheader="Player Info">
<ListItem primaryText={`Name: ${videosInformation.time}`} />
<ListItem primaryText={`Nickname: ${videosInformation.date}`} />
<ListItem primaryText={`Age: ${videosInformation.gameId}`} />
<ListItem primaryText={`Language: ${videosInformation.gameName}`} />
</List>
</Paper>
</Column>
<Column>
<iframe width="560" height="315" src="https://www.youtube.com/embed/Ta4xuThmAsQ" frameBorder="0" allowFullScreen></iframe>
</Column>
</Row>
</Grid>;
};

}


I am using Material-UI

Answer

It is likely that your Layout file is not exporting one of the variables from this line

import { Grid, Row, Column, List, ListItem } from '../../components/Layout';

The warning would happen if one of those is undefined.

Comments