Reputation: 373
I want to comment TSX code that I showed below. How can I do that?
<Form.Group controlId="type"> <Form.Label>Type</Form.Label>
Upvotes: 27
Views: 47271
Reputation: 17596
There are a few ways.
<Form.Group controlId="type">
{/* Hello World */}
<Form.Label>Type</Form.Label>
</Form.Group>
<Form.Group controlId="type">
{
// Hello World
}
<Form.Label>Type</Form.Label>
</Form.Group>
<Form.Group controlId="type">
{/*
Hello
World
*/}
<Form.Label>Type</Form.Label>
</Form.Group>
<Form.Group /* Hello World */ controlId="type">
<Form.Label>Type</Form.Label>
</Form.Group>
Upvotes: 30
Reputation: 84947
To add a comment in the middle of JSX, use curly brackets to pop back into plain javascript, then add your comment:
<Form.Group controlId="type">
{/* Hello World */}
<Form.Label>Type</Form.Label>
</Form.Group>
Typescript doesn't change this.
Upvotes: 33