Help us understand the problem. What is going on with this article?

今更聞けない JSX のコメントアウトの構文

More than 5 years have passed since last update.

今更聞けない JSX のコメントアウトの構文

解決したいこと

React 初心者なので、JSX コード内で HTML にレンダリングさせたくない部分をコメントアウトする方法がわからない。

方法

{/* ... */} または {// ...} という構文でコメントアウトできる。

var Header = React.createClass({
  displayName: 'Header',
  render: function () {
    return (
      <div>
        {// <h1>wasshoi</h1>
        } 
        <nav>
          <ul className="header--nav">
            <li>
              <a href="#">hoge</a>
            </li>
            {/*
            <li>
              <a href="#">fuga</a>
            </li>
            */}
          </ul>
        </nav>
      </div>
    );
  }
});

やっとでスタートラインに{・_・}

naoiwata
hachidoriinc
「すべての人に、価値ある仕事を」先端技術と上手く共存し、すべての人が、人間にしかできない「価値ある」仕事に集中できる世界を作りたい。そんな思いでhachidoriはサービスを提供しています。
https://hachidoriinc.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした