-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to access the value of the component #127
Comments
One solution I found: console.log(React.findDOMNode(this.refs.myinput.refs.entry).value); |
I trying to figure that also, you method seems the most logical so far. except I would write it like this: |
Got the value of the input by binding the onChange event: <Typeahead
options={apps}
maxVisible={10}
placeholder="Search"
onChange={this.props.onSearched.bind(null, event)}
/> And then on the parent component: render: function() {
return (
<Search
apps={this.state.appsCollection}
onSearched={this._onSearched}
/>
);
},
_onSearched: function(event) {
console.log(event.target.value);
} Hope this helps 😄 |
You can retrieve the value through the component state:
|
+1 Use the state.entryValue. Don't make your code brittle by relying on underlying DOM structure On Fri, Dec 4, 2015 at 2:56 PM, Loïc Giraudel [email protected]
|
Really stupid question what is the correct way to access the value of the input text after a value is set by the user?
The text was updated successfully, but these errors were encountered: