react-typeahead
react-typeahead copied to clipboard
Remote data support
Hi, is remote data supported?
Thanks in advance V
I have the same question. I don't see anything mentioned about remote data support in the docs. Thanks
Wouldn't you simply have a parent element which deals with the remote data and pass it as a property to the type ahead? Not sure if I am missing a more specific use case here.
On Thursday, September 10, 2015, Sriprabha [email protected] wrote:
I have the same question. I don't see anything mentioned about remote data support in the docs. Thanks
— Reply to this email directly or view it on GitHub https://github.com/fmoo/react-typeahead/issues/84#issuecomment-139352207 .
this is about providing the ability to fetch data from a remote source and filter it based on each character entered in the typeahead, that is, and display the filtered results in the dropdown for the typeahead.
@vincenzo-antolini-os did you managed to use this component with remote data? It would be useful to have an example on the readme...the scenario is quite usual.
thx
I managed to bind dynamic remote data attaching to the onKeyUp event
handleKeyUp() {
if (arguments[0].target) {
const inputValue = arguments[0].target.value;
fetch(`your end point here ${inputValue}`)
.then(res => {
return res.json();
})
.then(data => {
this.setState({ options: data.results });
});
}
}