Languages
[Edit]
EN

React - how to comment source code

3 points
Created by:
Jun-L
963

In this article, we would like to show you how to comment source code in React.

Quick solution (inside JSX):

 

In React writing source code in JavaScript we have two cases of using comments:

  • pure JavaScript lines, we use comments such as:
    // single-line comment or /* multi-line comment */,
  • JSX notation lines we have to wrap them in curly braces additionally, e.g. {/* comment */}.

Practical example:

Note:
Inside JSX HTML comments are not supported.

Alternative titles

  1. React - how to comment inside jsx
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

ReactJS

React - comment source code
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join