Created
November 2, 2016 02:51
-
-
Save firec0der/6f7ef87eba01544d76b9ce9043953bfe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onSearchSuccess = (places) => { | |
const changeHeader = (num, callback) => { | |
const header = { formHeader: `We Found ${num} Local Caregivers` }; | |
this.setState( | |
...(callback ? [header, callback] : [header]) | |
); | |
}; | |
Array.isArray(places) && ( | |
places.reduceRight((acc, place, index) => | |
changeHeader.bind(null, index, () => setTimeout(acc, 25)), | |
changeHeader.bind(null, places.length) | |
) | |
)(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment