I would like to use ECMA static proptypes within my React code. Unfortunately this throws the following Babel error
Missing class properties transform.
import React from 'react';
import bookSingleLine from '../Kooks/Table/BookSingleLine';
import TrackerReact from 'meteor/ultimatejs:tracker-react';
export default class bookListingTable extends TrackerReact(React.Component) {
static propTypes = {
LimitProp: React.PropTypes.number.isRequired
}
static defaultProps ={
LimitProp: 5,
}
Just manually assign the static properties instead of declaring them in the class body (which is not supported in ES7):
export default class BookListingTable extends TrackerReact(React.Component) {
…
}
BookListingTable.propTypes = {
LimitProp: React.PropTypes.number.isRequired
};
BookListingTable.defaultProps = {
LimitProp: 5
};