ReactJS - How to use comments?

后端 未结 13 1760
情深已故
情深已故 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:49

    So within the render method comments are allowed but in order to use them within JSX, you have to wrap them in braces and use multi-line style comments.

    {/* whenClicked is a property not an event, per se. */}

    You can read more about how comments work in JSX here

提交回复
热议问题