Question 3. Pass the event handler


Not sure why I cannot get the following code working in the Parent.js

  1. Pass changeName down to Child!

In Parent.js, inside of Parent's render function, add a second attribute to . Give this attribute a name of onChange, and a value of the changeName function.

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

var Parent = React.createClass({
  getInitialState: function () {
    return { name: 'Frarthur' };

  changeName: function (newName) {
    name: newName

  render: function () {
    return (

	<Parent />, 


No comma needed between attributes (I don't think).
Also: onChange={this.changeName} since you're just passing the function there.


Thanks Melissa It works now


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