This code doesnot execute


#1

react.js part 2: Child Components Upgrade Their Siblings' props

the run button keeps on spinning, no message or anything. I think the code is correct, pls advice


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

var Parent = React.createClass({
  getInitialState: function () {
    return { name: 'Frarthur' };
  },
  
  changeName: function (newName) {
    this.setState({
      name: newName
    });
  },

  render: function () {
    return (
      <div>
        <Child 
          onChange={this.changeName} />
        <Sibling 
          name={this.state.name} />
      </div>
    );
  }
});

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


#2

I don't know why or how, but the problem is fixed and the code that just worked was what I wrote before. A flaw in the system?


#3

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