Files
freeCodeCamp/common/app/flux/Store.js

19 lines
433 B
JavaScript
Raw Normal View History

import { Store } from 'thundercats';
const { createRegistrar, setter } = Store;
const initValue = {
username: null,
picture: null,
points: 0
};
export default Store(initValue)
.refs({ displayName: 'AppStore' })
.init(({ instance: appStore, args: [cat] }) => {
const { setUser } = cat.getActions('appActions');
const register = createRegistrar(appStore);
register(setter(setUser));
return appStore;
});