Last active
May 29, 2019 22:19
-
-
Save bradfordlemley/465b3ac6c766e0d962f6ec7301f006d8 to your computer and use it in GitHub Desktop.
Adding methods to composed state
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, | |
addTodo: todoLib.addTodo, | |
}); | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment