File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ function render() {
1010 ReactDOM . render (
1111 < App
1212 stories = { store . storyStore . readableStories }
13- onArchive = { ( objectID ) => store . archiveStore . archivedStoryIds . push ( objectID ) }
13+ onArchive = { ( objectID ) => store . archiveStore . archiveStory ( objectID ) }
1414 /> ,
1515 document . getElementById ( 'root' )
1616 ) ;
Original file line number Diff line number Diff line change 1- import { observable } from 'mobx' ;
1+ import { observable , action } from 'mobx' ;
22
33class ArchiveStore {
44 @observable archivedStoryIds = [ ] ;
55
66 constructor ( rootStore ) {
77 this . rootStore = rootStore ;
88 }
9+
10+ @action archiveStory = id =>
11+ this . archivedStoryIds . push ( id ) ;
912}
1013
1114export default ArchiveStore ;
Original file line number Diff line number Diff line change 1+ import { useStrict } from 'mobx' ;
2+
13import StoryStore from './storyStore' ;
24import ArchiveStore from './archiveStore' ;
35
6+ useStrict ( true ) ;
7+
48class RootStore {
59 constructor ( ) {
610 this . storyStore = new StoryStore ( this ) ;
You can’t perform that action at this time.
0 commit comments