7.The Render Function


#1


7. The Render Function


Seem to have a problem. I might have fooled around with the app.js code and now both new.js and app.js are not linking properly. If there was a reset I would use it.

Error is: Make sure that you are saving the result of React.createClass() as a var named MyComponentClass


Replace this line with your code. 
app.js

var React = require('react');
var ReactDOM = require('react-dom');



var MyComponentClass = React.createClass({
  render: function () {
    return <h1>Hello world</h1>;
  }
  
});
React.createClass()= MyComponentClass
ReactDOM.render(
	<MyComponentClass />, 
	document.getElementById('app')
);
new.js

var React = require('react');
var ReactDOM = require('react-dom');
var MyComponentClass = React.createClass();

var componentBlueprint = {};

var ReactDOM = require('react-dom');
var componentBlueprint = {
render: function () {
  return <h1>Hello world</h1>;
 }
};
Var MyComponentClass = React.createClass(componentBlueprint);


#2

This line may be the cause of the problem in app.js.

These lines may be the cause of the problem in new.js.

var should be lowercase.


#3

Thank you mtf. The capital v was the problem. Can't see how I missed it.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.