After doing the React tutorial this is my index.html file:
In a project created with the create-react-app tool separating components seems to work fine like this. Define the component in a file Hello.jsx
:
import React from 'react';
var Hello = React.createClass({
render: function() {
return (
Hello world!
);
}
});
// Must export!
export default Hello;
And then you can import the component in another file with
import Hello from './Hello.jsx'