Passing a prop into the child element


#1


Stuck at this exercise:


React.js Part II 4. Build a Stateless Component Class - step 4/6


I cannot figure out why it is incorrect.


Below my Child.js


var React = require('react');

var Child = React.createClass({
  render: function() {
    return (<h1>Hey, my name is {this.props.name}!</h1>
  });
});


Below my Parent.js

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


var Parent = React.createClass({
  getInitialState: function() {
    return { name: 'Frarthur' };
  },
  
  render: function() {
    return 
      <div>
      	<Child name={this.state.name} />
    	</div>;
  }
});

#2

Child.js


var React = require('react');

var Child = React.createClass({
    render: function() {
        return (<h1>Hey, my name is {this.props.name}!</h1>
        );}
});

Check Line 6: I believe you have the bracket misplaced.


#3

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