I know how to do everything in commenting but not at the end of a line.
Thanks
I know how to do everything in commenting but not at the end of a line.
Thanks
What language, please?
JavaScript - I am learning React
Thanks
With JS, it is just //
to add a comment at the end of the line.
With React it can get more complicated if you are trying to do it in JSX. That is not a VS Code issue but one of dealing with JSX. You might need to share a code example.
<div class="example"> </div> <!-- comment here -->
I would like to add a comment to the end of any of these lines.
First off, please don’t post pictures of code - post code. You just have to put three back ticks on the line before and three more on the line after so it formats well.
Next, yeah, If you are in JSX, you are are in this weird state. To get back to JS, you need to escape with curly braces, and then you can do a JS comment:
<div>
<p>Some text</p> {/* my comment */}
</div>
I wish that they’d allowed for normal JS comments when the designed JSX. They didn’t.
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>
) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).
Hi Kevin,
thanks for the answer and I will post correctly next time.
Take care.
Simon
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.