Put an Event Handler in a Component Class - Who can explain me exactly the reasoning?


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

var Talker = React.createClass({
  talk: function () {
  for (var speech = '', i = 0; i < 10000; i++) {
    speech += 'blah ';
  render: function () {
    return <Button talk={this.talk}/>;

  <Talker />,

I found this solution that works very well in an other post on the forum. But the post says just to add


to the component instance, it doesn't explain why it works. Who could help me with an explanation?!
Why I need to add a property with the name of the function I created on the React.createClass, and the value with the same function?



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