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?
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章