Marcelo Carmona
Published on

How to comment in React JSX

Authors

The way that we can make comments in React is a little weird, and when we search information is difficult to find it. It is not possible to use HTML comments inside of JSX

render() { return (
<div>
  <!-- this does not work -->
</div>
) }

It is necessary to use comments in Javascript but for that we will need to use the curly brackets in the following way:

{
  /* A JSX comment */
}

And multiline

{
  /* 
    A multiline JSX
    JSX
    comment
*/
}