Last active
October 11, 2015 22:33
-
-
Save nickretallack/4f2fbe4fdc124bfa08b3 to your computer and use it in GitHub Desktop.
"this" is null in my handler. Am I doing something wrong here?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'babel/polyfill'; | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
class FileUploadPage extends React.Component { | |
handleSubmit(event) { | |
event.preventDefault(); | |
console.log(this.refs.url.value.trim()) | |
} | |
render() { | |
return ( | |
<div> | |
<form onSubmit={this.handleSubmit}> | |
<input type="text" ref="url"/> | |
<button>Fetch</button> | |
</form> | |
</div> | |
); | |
} | |
} | |
ReactDOM.render(<FileUploadPage/>, document.getElementById('root')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'babel/polyfill'; | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
var FileUploadPage = React.createClass({ | |
handleSubmit: function(event) { | |
event.preventDefault(); | |
console.log(this.refs.url.value.trim()); | |
}, | |
render: function() { | |
return ( | |
<div> | |
<form onSubmit={this.handleSubmit}> | |
<input type="text" ref="url"/> | |
<button>Fetch</button> | |
</form> | |
</div> | |
); | |
} | |
}) | |
ReactDOM.render(<FileUploadPage/>, document.getElementById('root')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment