ES6 React组件的JSDoc

9
我认为React组件的JSDoc注释应该长这样:

/**
 * My component...
 *
 * @namespace MyComponent
 * @memberof app.components
 */
app.components.MyComponent = React.createClass({
    })

但是如果我使用 ES6,它应该长得像什么?

/**
 * My component...
 *
 * @namespace MyComponent
 * @memberof ??
 */
    class MyComponent extends Component {
      /**
       * PropTypes
       * @param {string} element
       */
      static propTypes = {
          element: PropTypes.object
      }

      /**
       * Constructor
       * How to take care about onChange and states?
       */
      constructor () {
        super()
        this.onChange = this.onChange.bind(this)
        this.state = {
          anything: true
        }
      }
    }

此外,我不理解如何记录静态propTypes和构造函数...

是否还有其他标签缺失,以实现“最佳”文档记录?

2个回答

9

1

2
虽然这个链接可能回答了问题,但最好在此处包含答案的基本部分并提供参考链接。仅有链接的答案如果链接页面发生更改可能会变得无效。 - csabinho

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接