Grokking React Native
0% completed
Frequent Events, Listeners, and Handler Tests
Typing the word milk into a search box fires onChangeText four times, once for each letter. If each event started a network search, the app would send four requests, and three of the answers would be for text the user had not finished typing.
The previous lesson covered how to write a single handler. The habits here apply when events repeat quickly, when a listener must be removed by hand, and when a handler has several branches that need testing. As before, each example shows only its component. To run one, add the imports it uses and render it from App.
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%