I had a problem to define propTypes
for my React class. I ran into solution that doesn't feel right:
let React = require('react')
let CallerCard = require('caller-card')
class CallerDetailsPanel {
render() {
return (
<div className='caller-details-panel'>
<CallerCard person={this.props.callerData.owner} />
<CallerCard person={this.props.callerData.user} />
</div>
)
}
}
CallerDetailsPanel.prototype.propTypes = {
callerData: React.PropTypes.object
}
module.exports = React.createClass(CallerDetailsPanel.prototype)
Is this correct approach or how propTypes
should be defined? If I try to define them inside class, I get a Parse error from 6to5 / esprima on console.