JSDoc for the reaction component ES6

I think the JSDoc comment for the responsive component might look like this:

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

But what should it look like if I use 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
        }
      }
    }

Also I don't understand how to document static propTypes and constructor ...

Are there more tags for "better" documentation?

+4
source share
1 answer

Since you are using ES6 modules, you do not need to specify a namespace or "@memberof".

jsdoc-react, , styleguidist, jsdoc, proptypes. , .

+1

Source: https://habr.com/ru/post/1681327/


All Articles