ElJefeJames ElJefeJames - 1 year ago 133
React JSX Question

ECMA7 static prototypes is not yet supported in Meteor, what is a good workaround?

I would like to use ECMA static proptypes within my React code. Unfortunately this throws the following Babel error

Missing class properties transform.
. As far as I'm aware this is because Meteor does not yet support stage 0 ECMA proposals.

From reading various threads it seems like it may be possible to resolve this by amending some babel configs, however I'm not too familiar with Babel so would rather avoid screwing with it too much. How can I express the below static /proptypes logic in an alternative, supported fashion?


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,

Answer Source

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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download