React Debounce Uncontrolled Input onChange Example | Fast lodash tutorial

Опубликовано: 28 Август 2021
на канале: Carmelle Codes
31,004
515

Let’s go over an example with debounce using a simple search bar from Part 1! We use lodash’s debounce to delay making our search call, until the user is done typing. This will allow your code to scale because there won’t be a bottleneck wherein every time the user changes the input, there’s a call to an expensive search. This is a simple example, but debounce’s benefits really begin to show when there’s some expensive API call involved. That way, your code won’t unnecessarily call on some API until it needs to.

CHANGELOG
Edit July 1 2022: Changed title to specify "Uncontrolled" input specifically

PART 1:    • How to make a simple search bar in Re...  
CodePen: https://codesandbox.io/s/yit93