9.10 I dont get it. What do you mean write an new instance of MyCompenantClass?

MyComponentClass is now a working component class! It’s ready to follow its instructions object and make some React components.

So, let’s make a React component! It only takes one more line:

To make a React component, you write a JSX element. Instead of naming your JSX element something like h1 or div like you’ve done before, give it the same name as a component class. Voilà, there’s your component instance!

JSX elements can be either HTML-like, or component instances. JSX uses capitalization to distinguish between the two! That is why component class names must begin with capital letters. In a JSX element, that capitalized first letter says, “I will be a component instance and not an HTML tag.”

Instructions

At the bottom of new.js, create an instance of MyComponentClass

What does this mean create an instance of MyComponentClass?
I did: var MyComponentClass2 = new MyComponentClass();
I get this error message:

Your component instance should look like <MyComponentClass />

What the heck does it want?

This is what is in the Text Editor Already:
var React = require(‘react’);
var ReactDOM = require(‘react-dom’);

var MyComponentClass = React.createClass({
render: function () {
return

Hello world

;
** }**
});

ReactDOM.render({
,
document.getElementById(‘app’)
}
);

just write < MyComponentClass />; on the last line without space between < and MyComponentClass

This is still not working

That is not working

Dang it I figured it out. I was in app.js the whole time when I should have been in new.js. I hope none of you make this miserable mistake.

1 Like

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