Skip to content

Commit

Permalink
part 10
Browse files Browse the repository at this point in the history
  • Loading branch information
rwieruch committed Sep 1, 2017
1 parent 650710d commit 780eaaa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function render() {
ReactDOM.render(
<App
stories={store.storyStore.readableStories}
onArchive={(objectID) => store.archiveStore.archivedStoryIds.push(objectID)}
onArchive={(objectID) => store.archiveStore.archiveStory(objectID)}
/>,
document.getElementById('root')
);
Expand Down
5 changes: 4 additions & 1 deletion src/stores/archiveStore.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { observable } from 'mobx';
import { observable, action } from 'mobx';

class ArchiveStore {
@observable archivedStoryIds = [];

constructor(rootStore) {
this.rootStore = rootStore;
}

@action archiveStory = id =>
this.archivedStoryIds.push(id);
}

export default ArchiveStore;
4 changes: 4 additions & 0 deletions src/stores/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { useStrict } from 'mobx';

import StoryStore from './storyStore';
import ArchiveStore from './archiveStore';

useStrict(true);

class RootStore {
constructor() {
this.storyStore = new StoryStore(this);
Expand Down

0 comments on commit 780eaaa

Please sign in to comment.