Showing posts with label How to comment in React JSX. Show all posts
Showing posts with label How to comment in React JSX. Show all posts

Tuesday, March 3, 2020

How to comment in React JSX

We cannot use HTML comments inside of JSX because it thinks they are real DOM Nodes:

render() {
  return (
    <div>
      <!-- This doesn't work! -->
    </div>
  )
}

We can use regular /* Block Comments */, but this need to be wrapped in curly braces:

{/* A JSX comment */}

Popular Posts