chcę dodać jakieś zasady rekwizytów:statyczne propTypes nie działa pod ES6
import React, { Component } from 'react'
export default class App extends Component {
static propTypes = { name: React.PropTypes.string.isRequired };
render() {
return(
)
}
}
Ale mam ten błąd:
Warning: Failed prop type: Required prop `name` was not specified in `App`.
mam tę konfigurację dla babel:
{
"presets": ["es2015", "react"],
"plugins": ["transform-runtime", "transform-class-properties"]
}
Co zrobiłem źle?
Aktualizacja. Zmień kod: użyj: static
Możliwy duplikat [ES6 klasy zmiennych alternatyw] (http://stackoverflow.com/questions/22528967/es6-class-variable-alternatives) –