Add Comments in JSX Front end development Libraries

Tell us what’s happening:
Hi can someone point out to me where I am going wrong with this challenge for addingcomments in JSX after several attempts I still can’t figure out where I am going wrong.

   **Your code so far**

const JSX = (
 <div>
 {/*
 <h1>This is a block of JSX</h1>
   <p>Here's a subtitle</p>
   */}
</div>
);
   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0.

Challenge: Add Comments in JSX

Link to the challenge:

You’ve commented out the h1 and p - don’t do that. Don’t comment anything out, just add a text comment in there - but the JSX should output the same thing it did before.

Im sorry im not entirely sure what you mean by that?

Can you clarify what you don’t understand so I don’t have to go through word by word?

** You’ve commented out the h1 and p** im not sure what you mean by this I have tried a few more times and cannot seem to get it to accept the code

Hi @meechy987 !

You are not supposed to wrap the comment tags around the h1 and p elements.
FCC instructions:
without modifying the existing h1 or p elements.

I would reset the lesson.

You only need to write the comment above h1 or bellow the p tag.

Hope that makes sense!

1 Like

Im sorry I have no idea here and unfortunately I still am unsure what is meant by this the help provided from the tip is no actual help

const JSX = (
  <div>
ADD COMMENT HERE

    <h1>This is a block of JSX</h1>
    <p>Here's a subtitle</p> 

OR ADD COMMENT HERE
  </div>
);
1 Like

to add a comment within a JSX code, you practically need to add a JavaScript code which represents comment. To put a JavaScript code within JSX, you wrap it inside curly braces { your code } . For JS comments you use /* your comment */ . So in conclusion, you use {} inside which you put your comment- {/*comment inside JSX*/}
In your code you have wrapped your h1 and p tags within the JS comment body, which contradicts with the challenge requirements. You shouldnt comment out parts of the html/JSX

1 Like

That’s 100% cool, we’ve all been there. That’s why this forum exists. Just let us know if you need more clarification. My point was just to make your questions specific.

2 Likes

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