I have been trying to learn React with Redux the past couple of weeks. I can't seem to pass down an action as a property correctly as when I run it I get a "cannot read property "props" of null. However finding some code online I was able to try it out using es5 syntax and it worked. Does anyone understand what I am doing wrong in es6 and how I can make it work? Below is my attempt at es6 which does not work with the es5 style commented out which does work.
import React, { Component, PropTypes } from 'react'
export default class InputFoo extends Component {
//export default React.createClass({
submitHandler(evt){
evt.preventDefault()
const { inputFooAction } = this.props
inputFooAction(evt.target[0].value);
}
//,
render() {
const { input } = this.props
return (<div>
<h1>Oh hey from inside the component {input}</h1>
<form onSubmit={this.submitHandler}>
<input type="text" id="theInput"/>
</form>
</div>)
}
}// )
//block below is commented out for es5
InputFoo.propTypes = {
inputFooAction: PropTypes.func,
input: PropTypes.string
}