How can I use comments inside the render method in a React component?
I have the following component:
\'use strict\';
Here is another approach that allows you to use // to include comments:
return (
{
// Your comment goes in here.
}
{
// Note that comments using this style must be wrapped in curly braces!
}
);
The catch here is you cannot include a one-line comment using this approach. For example, this does not work:
{// your comment cannot be like this}
because the closing bracket } is considered to be part of the comment and is thus ignored, which throws an error.