Skip to content

Instantly share code, notes, and snippets.

@jamestthompson3
Created June 3, 2018 09:53
Show Gist options
  • Save jamestthompson3/d5a2aa074f22a92cccd30c74295375c7 to your computer and use it in GitHub Desktop.
Save jamestthompson3/d5a2aa074f22a92cccd30c74295375c7 to your computer and use it in GitHub Desktop.
const textHandler = mapPropsStream(props$ => {
const { stream: onInput$, handler: handleChange } = createEventHandler()
const text$ = onInput$.pipe(map(e => e.target.value), startWith(''))
return props$.pipe(
switchMap(props => text$.pipe(map(text => ({ ...props, text, handleChange }))))
)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment