PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

React · Theory

Comments in React

← All stacks

Theory

70/94

Comments in React

Inside JSX you cannot use <!-- HTML comments -->. Use {/* comment */}. Outside JSX, normal // and /* */. That’s the whole topic. People hit this when they paste HTML into a component.

Comments in React — <!-- HTML comments --> don’t work inside JSX. Use {/* */}.

Exam tip

{/* */} in JSX.

Example

// JSX comment
export default function Page() {
  return (
    <main>
      {/* promo banner off for exams */}
      <h1>Prep</h1>
    </main>
  );
}

Comments in React — <!-- HTML comments --> don’t work inside JSX. Use {/* */}.

Short notes

  • JSX : {/* */}.
  • JS : // or /* */.
  • Trap<!-- --> inside JSX.

Questions

1

Explain Comments as if you are teaching a junior — definition, then one tiny UI.

2

Write 5–10 lines that use Comments and say what the UI does.

3

What mistake do freshers make with Comments?

Previous← Composition vs Inheritance in ReactNextComponent vs PureComponent →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.