DEV Community

Discussion on: React Challenge: Autocomplete functionality in React from scratch

Collapse
 
mangor1no profile image
Mangor1no • Edited

It's ok for a fun project, where you are the only user. But don't use onChange event like this in a real life product. By using onChange to call API directly, the API will be harrassed. You should use debounce function for these action, or if you are lazy you can place the API call in onBlur event, so the API will be called only if the input form is not focused.

Collapse
 
cinarb2 profile image
CinArb/

Thank you so much for four feedback. I updated the blog post and added the solution with the debounce function and the useMemo hook. 🥳