How to comment code in React JSX

When it comes to commenting code in JSX, it’s not the same way we comment in regular JavaScript and HTML comments. For example, this is not allowed.

render() {
return (
<p> <!-- This is not allowed --> </p>
)
}

Here’s an easy and direct way to do it

{/* This is JSX comment */}

and

{/* 
This
is
multi
line
comment
*/
}
Like what you read? Give Phaneendra Brahmadevara a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.