Need help with 7/13, Put an event handler in a component class, please


#1


https://www.codecademy.com/courses/react-101/lessons/this-props/exercises/event-handler-component-class?action=lesson_resume


When I submit the code, it spins for every. I don't get any errors back. I'm not sure what is wrong. Any guidance is apprecaited. Thanks.


// Button.js

var React = require('react');

var Button = React.createClass({
  render: function () {
    return (
      <button onClick={this.props.talk}>
        Click me!
      </button>
    );
  }
});

module.exports = Button;


// Talker.js

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

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

ReactDOM.render(
  <Talker />,
  document.getElementById('app')
);


#2

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