FAQ: Advanced JSX - Variable Attributes in JSX


#1

This community-built FAQ covers the “Variable Attributes in JSX” exercise from the lesson “Advanced JSX”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn ReactJS: Part I

FAQs on the exercise Variable Attributes in JSX

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!


#2

I’m currently stuck with the error message “gooseImg should be equal to an element.”
My code:

import React from ‘react’;
import ReactDOM from ‘react-dom’;

const goose = ‘https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-goose.jpg’;

// Declare new variable here:
const gooseImg = (

);

My variable gooseImg seems to be equal to an img element. Am I missing something or is this a bug?


#3

import React from ‘react’;
import ReactDOM from ‘react-dom’;

const goose = ‘https://s3.amazonaws.com/codecademy-content/courses/React/react_photo-goose.jpg’;

// Declare new variable here:
const gooseImg = ();

ReactDOM.render(gooseImg, document.getElementById(“app”));

According to codes above, why at ReactDOM.render’s first parameter,
gooseImg does not need curly braces?


#4

Why doesn’t this work for the first step?

const gooseImg = (

);


#5

Like it definitely does work and even follows your example, and after adding the rest from part 2 it correctly displays the image?

const gooseImg = (

);

ReactDOM.render(gooseImg, document.getElementById(‘app’));


#6

I also had another issue in a previous course where I missed a comma, but it said I passed (green check box) even though it didn’t display the 2 + 3??? Do you guys test these courses?