Answer the question
In order to leave comments, you need to log in
How to implement filtering on an array, according to the data that is entered into the input?
Hello. There is an array of elements that are displayed as a list on the screen. The user has an input . When entering letters into this input, the list should change interactively, and only those elements should remain in the array - those that begin with the characters that the user entered.
I roughly understand how to do this: I hang the function on the onChangeText event, then I go through the array through the filter. But it seems to me that this is some kind of crutch, and there are either ready-made modules or a more correct solution
. Who faced this, please tell me how you implemented it? Or how would you do it
Answer the question
In order to leave comments, you need to log in
Normal decision, I do not see anything crutch.
on so the same answers
https://stackoverflow.com/questions/45666762/searc...
https://stackoverflow.com/questions/46805836/how-t...
here is the package if you are too lazy to write
https:// www.npmjs.com/package/react-native-search-...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question