mystor / meteor-routecore

Client and server side rendering/routing powered by React
84 stars 6 forks source link

Don't call methods in React Class #14

Closed MrEfrem closed 9 years ago

MrEfrem commented 9 years ago

upConter don't call by click button

/** @jsx React.DOM */
var layout = React.createClass({
    upCounter: function(e){
        console.log(1);
    },
    render: function(){
        return (
            <div>
                <h1>Welcome to Meteor!</h1>

                <button onclick={this.upCounter}>Click Me</button>
            </div>
            );
    }
});

RouteCore.map(function () {
    var home = this.route('/', layout);
});]]
mystor commented 9 years ago

Try changing the property name from onclick to onClick. Javascript (any by extension JSX) is case-sensitive.

MrEfrem commented 9 years ago

Thanks for the help. And onClick inner blazeComponent won't work?

mystor commented 9 years ago

I'm not sure what you mean by that. I don't think you can add event handlers to BlazeComponents, but inside the blaze component you can have click handlers in the normal Meteor way.

MrEfrem commented 9 years ago

Thanks for the help.