I have the following React component:
class Form extends React.Component { handleSubmit(e) { e.preventDefault(); let loginInput = ReactDOM.findDOMNode(this.refs.login);
As you can see, I want the handleSubmit function to handleSubmit called whenever the form is submitted. I indicated this by adding a function to the onSubmit handler.
The function is called at the right time. However, the value of this inside this function is null . This is surprising to me, as I expected this be a component of React. The fact that this is null surprises me because I use very similar logic / code offered by the official documentation.
I would appreciate help in figuring out why this not a React component, as expected, and how to fix the code so that it is.
source share