Input#6.0.1umd/csj/es #16.3.2#4.1.1
I just put ref on Input tag but, I can't I use typescript, so I used any type, but doesn't work
can use ref in
TypeError: _this.password.focus is not a function
class Login extends React.Component {
public password: any = null
someMethod = () => {
this.password.focus()
}
render() {
return (
<Input
type="password"
placeholder="Password Here"
ref={ref => {
this.password = ref
}}
/>
<button onClick={this.someMethod}> Click me! </button>
)
}
}
ref can only get a reference to the thing you use it on, Input. Use innerRef to get a reference to the underlying input.
Thank You!
refcan only get a reference to the thing you use it on,Input. UseinnerRefto get a reference to the underlying input.
Thanks man,you save my day
Most helpful comment
refcan only get a reference to the thing you use it on,Input. UseinnerRefto get a reference to the underlying input.