vendredi 26 mai 2017

Array iteration and if-statements in Action Creator in React Native

I have a ScrollView with data and I am currently implementing searchBar on the same page. Where would be a better practice to shrink the amount of data, that is retrieved from the firebase database based on the user's input in searchBar? 1. In the Action Creator that is currently deployed to simply fetch all the data from the database? 2. In the component itself? 3. Somewhere else?

I am planning to use lodash plugin and its .each method to iterate through the retrieved data and inside the .each method, I will use an if-statement in order to determine whether the current word in the iteration process has the string, that was retrieved from the search field. If it has - I add it to the new array, else - do nothing.

Aucun commentaire:

Enregistrer un commentaire