Created
November 16, 2019 23:59
-
-
Save webmasterdevlin/b7f57a8546174255d46b1c5006c3e70d to your computer and use it in GitHub Desktop.
computed
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
import { action, computed, createContextStore, thunk } from 'easy-peasy' | |
import { deleteHero, getHeroById, getHeroes, postHero, putHero } from './hero-service' | |
const HeroStore = createContextStore({ | |
/*states here*/ | |
/*actions thunk side effects here*/ | |
/*actions here*/ | |
/*computed values i.e. derived state*/ | |
totalHeroes: computed(state => Object.values(state.heroes).length) | |
}); | |
export default HeroStore; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment