Skip to content

Instantly share code, notes, and snippets.

@jacobp100
Last active January 16, 2018 20:34
Show Gist options
  • Save jacobp100/5082449c979cea295fe2a43f94911d42 to your computer and use it in GitHub Desktop.
Save jacobp100/5082449c979cea295fe2a43f94911d42 to your computer and use it in GitHub Desktop.
Rx.Observable.from(store)
.map(state => state.search)
.distinctUntilChanged()
.switchMap(search => (
getColorsObservable()
.filter(color => color.includes(search))
))
.subscribe(result => {
store.dispatch({ type: 'ADD_RESULT', result })
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment