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
The null is React. createElement is reserved for giving attribute values to the element. If you have none to pass then you put in a null, else you pass the attribute in a javascript object form. See example below. Here className is used for class as that is what is used in jsx to define html class.
The React. createElement function has many arguments: The first argument is the HTML "tag" for the DOM element to represent, which is div in this example. The second argument is for any attributes (like id , href , title , etc.)
createElement() Create and return a new React element of the given type. The type argument can be either a tag name string (such as 'div' or 'span' ), a React component type (a class or a function), or a React fragment type. Code written with JSX will be converted to use React.
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.
I know the right solution has been found here but I just wanted to share another possible reason for the ReactJS React.createElement: type should not be null or undefined
warning to trigger.
It can also happens when you have a circular dependency in your modules. Then, doing a console.log()
of your imported module would return an empty object.
For further details, have a look at this other stackoverflow thread: Require returns an empty object
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With