Stuck at 4/6


#1


4. Build a Stateless Component Class

I always get the following error:

Oops! The test returned an error. Maybe you have a syntax error, or a typo.

/home/ccuser/workspace/learn-react-04-01-02e/test/ test.js:6
TestedComponent = components[0];
^
TypeError: Cannot read property '0' of undefined

I don't see anything wrong with the code, I used arrow functions in all exercises before and they always worked:


//Child.js
var React = require("react");

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

module.exports = Child;

//Parent.js
var React = require("react");
var ReactDOM = require("react-dom");


var Parent = React.createClass({
  getInitialState: () => {
    return {name: "Frarthur"};
  },
  render: () => {
    return <div></div>;
  }
})


Thanks in advance! :slight_smile:


#2

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