Created
June 3, 2018 09:40
-
-
Save jamestthompson3/506b136a0aee1a044d3e0516faf63f65 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const modalHandler = mapPropsStream(props$ => { | |
const { stream: isOpen$, handler: toggleModal } = createEventHandler() | |
return props$.pipe( | |
switchMap(props => | |
isOpen$.pipe( | |
startWith(false), | |
scan(bool => !bool), | |
map(isOpen => ({ ...props, isOpen, toggleModal })) | |
) | |
) | |
) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment