Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to comment on .tsx file?

I want to comment TSX code that I showed below. How can I do that?

<Form.Group controlId="type"> <Form.Label>Type</Form.Label>

like image 689
K. Hansika Herath Avatar asked Sep 06 '25 00:09

K. Hansika Herath


1 Answers

There are a few ways.

Single line (Option 1)

<Form.Group controlId="type">
  {/* Hello World */}
  <Form.Label>Type</Form.Label>
</Form.Group>

Single line (Option 2)

<Form.Group controlId="type">
  {
    // Hello World
  }
  <Form.Label>Type</Form.Label>
</Form.Group>

Multi-line

<Form.Group controlId="type">
  {/* 
    Hello 
    World 
  */}
  <Form.Label>Type</Form.Label>
</Form.Group>

Attribute comment

<Form.Group /* Hello World */ controlId="type">
  <Form.Label>Type</Form.Label>
</Form.Group>
like image 171
Joe Muller Avatar answered Sep 07 '25 20:09

Joe Muller