Last active
May 29, 2019 23:16
-
-
Save bradfordlemley/0d5c459dec536c6bfa6140ff67008f31 to your computer and use it in GitHub Desktop.
State composition with mapState
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
import { mapState } from '@stated-library/core'; | |
const todoLib = createTodoLib(); | |
const counterLib = createCounter(); | |
const appState$ = mapState( | |
[todoLib.state$, counterLib.state$], | |
([todoLibState, counterLibState]) => ({ | |
todos: todoLibState.todos, | |
counter: counterLibState, | |
total: counterLibState + todoLibState.todos.length, | |
}); | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment