File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -9,15 +9,24 @@ import ColorList from './App';
9
9
import { rateColor , removeColor , addColor , sortColors } from './actions' ;
10
10
import { sortFunction } from './lib/array-helpers' ;
11
11
12
- export const NewColor = ( props , { store} ) =>
13
- < AddColorForm onNewColor = { ( title , color ) => store . dispatch ( addColor ( title , color ) ) } />
14
-
15
- NewColor . contextTypes = {
16
- store : PropTypes . object
17
- }
18
- export const Menu = ( props , { store} ) =>
19
- < SortMenu sort = { store . getState ( ) . sort } onSelect = { sortBy => store . dispatch ( sortColors ( sortBy ) ) } />
12
+ export const NewColor = connect (
13
+ null ,
14
+ dispatch =>
15
+ ( {
16
+ onNewColor ( title , color ) {
17
+ dispatch ( addColor ( title , color ) ) ;
18
+ }
19
+ } ) ( AddColorForm )
20
+ )
20
21
22
+ export const Menu = connect (
23
+ null ,
24
+ ( {
25
+ onSelect ( sortBy ) {
26
+ dispatch ( sortColors ( sortBy ) )
27
+ }
28
+ } ) ( sortMenu )
29
+ )
21
30
Menu . contextTypes = {
22
31
store : PropTypes . object
23
32
}
You can’t perform that action at this time.
0 commit comments