File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 1+ export const STORY_ARCHIVE = 'STORY_ARCHIVE' ;
Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ import React from 'react';
22import ReactDOM from 'react-dom' ;
33import App from './components/App' ;
44import store from './store' ;
5+ import { STORY_ARCHIVE } from './constants/actionTypes' ;
56import './index.css' ;
67import registerServiceWorker from './registerServiceWorker' ;
78
89ReactDOM . render (
910 < App
1011 stories = { store . getState ( ) . storyState }
11- onArchive = { ( ) => { } }
12+ onArchive = { id => store . dispatch ( { type : STORY_ARCHIVE , id } ) }
1213 /> ,
1314 document . getElementById ( 'root' )
1415) ;
Original file line number Diff line number Diff line change 1+ import { STORY_ARCHIVE } from '../constants/actionTypes' ;
2+
13const INITIAL_STATE = [ ] ;
24
5+ const applyArchiveStory = ( state , action ) =>
6+ [ ...state , action . id ] ;
7+
38function archiveReducer ( state = INITIAL_STATE , action ) {
49 switch ( action . type ) {
10+ case STORY_ARCHIVE : {
11+ return applyArchiveStory ( state , action ) ;
12+ }
513 default : return state ;
614 }
715}
You can’t perform that action at this time.
0 commit comments