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() {
10
10
ReactDOM . render (
11
11
< App
12
12
stories = { store . storyStore . readableStories }
13
- onArchive = { ( objectID ) => store . archiveStore . archivedStoryIds . push ( objectID ) }
13
+ onArchive = { ( objectID ) => store . archiveStore . archiveStory ( objectID ) }
14
14
/> ,
15
15
document . getElementById ( 'root' )
16
16
) ;
Original file line number Diff line number Diff line change 1
- import { observable } from 'mobx' ;
1
+ import { observable , action } from 'mobx' ;
2
2
3
3
class ArchiveStore {
4
4
@observable archivedStoryIds = [ ] ;
5
5
6
6
constructor ( rootStore ) {
7
7
this . rootStore = rootStore ;
8
8
}
9
+
10
+ @action archiveStory = id =>
11
+ this . archivedStoryIds . push ( id ) ;
9
12
}
10
13
11
14
export default ArchiveStore ;
Original file line number Diff line number Diff line change
1
+ import { useStrict } from 'mobx' ;
2
+
1
3
import StoryStore from './storyStore' ;
2
4
import ArchiveStore from './archiveStore' ;
3
5
6
+ useStrict ( true ) ;
7
+
4
8
class RootStore {
5
9
constructor ( ) {
6
10
this . storyStore = new StoryStore ( this ) ;
You can’t perform that action at this time.
0 commit comments