ReactJS - 如何使用註釋? - ReactJS - How to use comments?

問題:

How can I use comments inside the render method in a React component?如何在 React 組件的render方法中使用註釋?

I have the following component:我有以下組件:

'use strict';
 var React = require('react'),
   Button = require('./button'),
   UnorderedList = require('./unordered-list');

class Dropdown extends React.Component{
  constructor(props) {
    super(props);
  }
  handleClick() {
    alert('I am click here');
  }

  render() {
    return (
      <div className="dropdown">
        // whenClicked is a property not an event, per se.
        <Button whenClicked={this.handleClick} className="btn-default" title={this.props.title} subTitleClassName="caret"></Button>
        <UnorderedList />
      </div>
    )
  }
}

module.exports = Dropdown;  

在此處輸入圖片說明

My comments are showing up in the UI.我的評論顯示在用戶界面中。

What would be the right approach to apply single and multiple line comments inside a render method of a component?在組件的渲染方法中應用單行和多行註釋的正確方法是什麼?


解決方案:

參考一: https://stackoom.com/question/255kv
參考二: ReactJS - How to use comments?
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章