I'm trying to learn ReactJS at the moment, with all the differing tutorials using ES5 / ES6 and all the other differences in versions of React it is a little frustrating to say the least. Can anyone see why the code below would throw the following error to console?
Error Message:
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)
Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, Navigation } from 'react-router'
/*
Main App layout
*/
var App = React.createClass ({
render: function () {
return (
<div className="catch-of-the-day">
<div className="menu">
<Header tagline="Seafood and Eat it!"/>
</div>
<Order/>
<Inventory/>
</div>
)
}
});
/* Header */
var Header = React.createClass ({
render: function() {
return (
<header className="top">
<h1>Catch
<span className="ofThe">
<span className="of">of</span>
<span className="the">the</span>
</span>
day</h1>
<h3><span>{this.props.tagline}</span></h3>
</header>
)
}
});
/* Order */
var Order = React.createClass ({
render: function() {
return (
<p>Order</p>
)
}
});
/* <Inventory/> */
var Inventory = React.createClass ({
render: function() {
return (
<p>Inventory</p>
)
}
});
/*
Store Picker
This will let us make <StorePicker/>
*/
var StorePicker = React.createClass ({
render: function () {
return (
<form className="store-selector">
<h2>Please enter a store</h2>
<input type="text" ref="storeId" />
<input type="submit" />
</form>
)
}
});
/*
Routes
*/
var Routes = (
<Router>
<Route path="/" component={StorePicker} />
<Route path="/store/:storeid" component={App} />
</Router>
)
ReactDOM.render(<Routes/>, document.querySelector('#main'));