Not able to get values of input type using this.refs... how to get that values from input type
export class BusinessDetailsForm extends Component {
subm
using ref={ inputRef => this.input = inputRef }
is considered legacy now. In React 16.3 onwards, you can use the code below,
class MyForm extends React.Component {
constructor(props) {
//...
this.input = React.createRef();
}
handleSubmit(event) {
alert('A name was submitted: ' + this.input.current.value);
event.preventDefault();
}
render() {
return (
);
}
}
EDIT: thanks for the comment @stormwild