0
static propTypes: {
        arrayOfLines: PropTypes.arrayOf(PropTypes.number)
    };

at arrayOf( < at that paren it gives me a syntax error, but looking at the docs it seems like it should be right doing just PropTypes.array seems to work fine too, or number

My includes are this:

import React, {Component, PropTypes} from 'react';
import ReactDOM from 'react-dom';
import CodeLine from './CodeLine';
import GridSpace from './GridSpace';

export default class Grid extends React.Component{

    static propTypes: {
        arrayOfLines: PropTypes.arrayOf(PropTypes.number)
    };

    renderGridSpace(x,y) {
        const gray = (x + y) % 2 === 1;

        const [spaceX, spaceY] = this.props.arrayOfLines
    }

    render() {
        const { gray } = this.props;
        const fill = gray ? 'gray' : 'white';
        const stroke = gray ? 'white' : 'gray';
        console.log(PropTypes);
        return (
            <div style={{ 
            backgroundColor: fill,
            color: stroke,
            width: '100%',
            height: '100%'
             }} >
                {this.props.children}
            </div>
        );
    }

}

this is actually just from the reactdnd demo

Karan
  • 1,141
  • 2
  • 19
  • 42
  • *What* gives you the syntax error? Are you using a transpiler? Have you checked to make sure it understands this syntax and that it's configured to do so? – Jordan Running Dec 04 '15 at 23:04
  • 2
    `static propTypes = {}` <--- it should be `=` there not `:` – zerkms Dec 04 '15 at 23:12

1 Answers1

3

As per the stage-1 proposal the static property is followed by = not :

static propTypes = {
    arrayOfLines: PropTypes.arrayOf(PropTypes.number)
};

References:

zerkms
  • 249,484
  • 69
  • 436
  • 539