Zee
Zee

Reputation: 1420

React error when following tutorial

I'm trying to follow a pluralsight tutorial for getting started with react js. The point of the tutorial is that clicking on the button results in an incremented value for the button. I followed the exact code the person the in the tutorial had but I cannot figure out why the button wont increment. Here is the link to the plunk for this tutorial.

My guess is that maybe there is something wrong with my

handleClick: function(){
    this.setState({ counter: this.state.counter+1 });
  },

function?

Upvotes: 0

Views: 72

Answers (1)

codemax
codemax

Reputation: 1352

Your

onclick

should be

onClick

instead.

Change that and it should work.

Also, you might want to use

ReactDOM.render

instead of

React.render

Refer to this https://facebook.github.io/react/tips/props-in-getInitialState-as-anti-pattern.html

Upvotes: 2

Related Questions