3 ms·
The example you highlighted as "doing it wrong" is pretty typical for an autosuggest component: Input updates trigger some request, which propagates to some li
by cetra3 4y ago
The example you highlighted as "doing it wrong" is pretty typical for an autosuggest component: Input updates trigger some request, which propagates to some list somewhere else in the dom. As it's loading, a spinner is shown, but when results are retrieved, they're updated again. Throw in apollo to the mix or some other request library, and context is used.
- treis 4y agoThink you're gonna have a bad time. Should be something like: function handleChange(e){ getAutoSuggestions() setLoadingState(true) } ^ Side effects happen in response to user input function getAutoSuggestionsCallback(resp){ setSuggestions(resp) setLoadingState(false) } ^ No side effects