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
You should avoid ref="googleInput"
as it is now considered legacy. You should instead declare
ref={(googleInput) => { this.googleInput = googleInput }}
Inside of your handler, you can use this.googleInput
to reference the element.
Then inside of your submitForm
function, you can obtain the text value with
this.googleInput._getText()
String refs are legacy https://facebook.github.io/react/docs/refs-and-the-dom.html
If you worked with React before, you might be familiar with an older API where the ref attribute is a string, like "textInput", and the DOM node is accessed as this.refs.textInput. We advise against it because string refs have some issues, are considered legacy, and are likely to be removed in one of the future releases. If you're currently using this.refs.textInput to access refs, we recommend the callback pattern instead.
Edit
From React 16.3, the format for creating refs are:
class Component extends React.Component
{
constructor()
{
this.googleInput = React.createRef();
}
render()
{
return
(
{/* Details */}
);
}
}