9

Given the following JSX code:

<div className="my-class"></div>

How can I comment out the className="my-class"?

  • /*className="my-class"*/ does not work
  • {/* className="my-class" */} does not work (TS1005:'...' expected)
Michael_Scharf
  • 33,154
  • 22
  • 74
  • 95

2 Answers2

13

/*className="my-class"*/ does not work

Works fine: enter image description here

You can also do:

<div 
  // className="my-class"
  >Hello</div>
basarat
  • 261,912
  • 58
  • 460
  • 511
0

comment in tsx file

Works for me fine. We use this way like this in my team.