Nadir Abbas
Nadir Abbas

Reputation: 67

React is not rendering anything?

I am new to React. I have this code and didn't get any console errors, still React isn't putting out anything on the screen.

This is my JSX code

var appComponent = React.createClass({
getDefaultProps: function(){
    return {
        appName: "First React 
Application"
    }
},
render: function(){
    return(
        <div>
            <h1>{this.props.appName}</h1>
        </div>
    )
}
});
ReactDOM.render(
  <appComponent />,
  document.getElementById('app')
);

Upvotes: 1

Views: 106

Answers (1)

Nadir Abbas
Nadir Abbas

Reputation: 67

I actually managed to solve it by capitalizing the first letter of the component, instead of appComponent, I wrote AppCompnent.

Upvotes: 1

Related Questions