Bug with Variable Attributes in JSX .7?


#1

Typing in this code:

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

var goose = 'https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-goose.jpg';

// Declare new variable here:
var gooseImg = (
  <img
	src={goose}
    alt="Goose" />
);


/*ReactDOM.render(
  gooseImg,
  document.getElementById('app')
); */

yet getting this error message:

"gooseImg should be equal to an element."

Any help appreciated..


#2

id do it on one line without the () and idk why you have alt attribute there.

i would guess it's not picking up that its an html element because of the ( )


#3

Thanks removed the (...) parentheses worked but I can't help but think

Were we not taught JSX items are within (...)?


#4

I believe it is because ( ) is used for multi-line expressions (check that, but it had something to do with multi-line. I don't think you use () for the html elements that it was expecting in this exercise.


#8

Get rid of the 'alt="Goose"' as well as the parenthesis w/ semi-colon


#9

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