When Ever i submit this form the event.target turn out to be null this should hold the value of the text field? why is this happening as it is supposed the have values of the text field
import React, { Component } from "react";
class Login extends Component {
constructor(props) {
super(props);
this.state = {};
this.fun = props;
}
handleOnsubmit(event) {
event.preventDefault();
console.log("Inside ");
console.log(event.target);
}
render() {
return (
<>
<form onSubmit={this.handleOnsubmit}>
UserName:
<input type="text"></input>
<br></br>
Password:
<input type="text"></input>
<br></br>
<button type="submit">Submit</button>
</form>
</>
);
}
}
export default Login;

this should hold the value of the text field- no, it should be theform, as that is the element emitting the submit event - I don't know what react does to events to make itnull, but it definitely would never be a text field