ReactJS - How to use comments?

后端 未结 13 1765
情深已故
情深已故 2020-12-04 08:17

How can I use comments inside the render method in a React component?

I have the following component:

\'use strict\';
          


        
13条回答
  •  借酒劲吻你
    2020-12-04 08:48

    { 
        // any valid js expression
    }
    

    If you wonder why does it work? it's because everything that's inside curly braces { } is a javascript expression,

    so this is fine as well:

    { /*
             yet another js expression
    */ }
    

提交回复
热议问题