Need help with ex 3/7


#1

https://www.codecademy.com/courses/react-101/lessons/react-components-advanced-jsx/exercises/render-function-calculations

I did as instruction says, but I have this error:

Friend's' <h1></h1> should contain {friend.title}.

// New component class starts here:
var Friend = React.createClass({
  
  render: function () {
    var friend = friends[1];
    
    return (
    	<div>
        <h1>{friend.title}</h1>
    	</div>
	  );
  }
});

Please, tell me what is wrong with my code?


#2

Are you meant to be returning a string here?


#3

yep, friends has string properties:

var friends = [
  {
    title: "Yummmmmmm",
    src: "https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-monkeyweirdo.jpg"
  },
  {
    title: "Hey Guys!  Wait Up!",
    src: "https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-earnestfrog.jpg"
  },
  {
    title: "Yikes",
    src: "https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-alpaca.jpg"
  }
];

#4

problem was here:

var friend = friends[1];

I changed index to 0 and 2 and passed the lesson, but when index I got error: Friend's' <h1></h1> should contain {friend.title}. Looks like a bug?


#5

This has been brought up before. There may be a bug report on it that has not yet been reviewed. Glad you took the initiative to try other indexes. That is what others have done, as well, with the same success.


#6

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