javascript - How to call debounce correctly? lodash -


i working on reactnative project , having bit of trouble using _.debounce method of lodash. current code:

class googleplacesautocompletemodal extends component {    constructor(props) {     super(props);     this.getpredictions = this.getpredictions.bind(this);   }    getpredictions(input) {     function getautocompletepredictions(input) {       rngoogleplaces.getautocompletepredictions(input)       .then(results => {         console.log('autocomplete results: ', results);         this.setstate({ predictions: results })       })       .catch(error => console.log(error.message))     }      _.debounce(getautocompletepredictions, 300);   }    render() {     return (       <textinput         style={inputstyle}         autocorrect={false}         maxlength={40}         autocapitalize={'words'}         onchangetext={this.getpredictions}       />     )   } } 

i dont see why debounce not working since followed documentation , understand function itself. welcome!


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -