1
1
2
2
import { connect } from 'react-redux' ;
3
- import { bindActionCreators } from 'redux' ;
4
- import { getMovieData } from '../../actions' ;
5
- import MovieComponent from '../../components/movieComponent'
3
+ import { bindActionCreators , AnyAction , Dispatch } from 'redux' ;
4
+ import { getMovieAction } from '../../actions' ;
5
+ import MovieComponent from '../../components/movieComponent' ;
6
+ import { AppState } from '../../rootReducer' ;
6
7
7
- const mapStateToProps = ( state : any ) => {
8
- return { state } ;
8
+ const mapStateToProps = ( state : AppState ) => {
9
+ return { state : state . GET_MOVIES } ;
9
10
}
10
11
11
- const mapDispatchToProps = ( dispatch : any ) => bindActionCreators ( { getMovieData } , dispatch ) ;
12
- export default connect ( mapStateToProps , mapDispatchToProps ) ( MovieComponent ) ;
12
+ const mapDispatchToProps = ( dispatch : Dispatch < AnyAction > ) => bindActionCreators ( { getMovieAction } , dispatch ) ;
13
13
14
+ export default connect ( mapStateToProps , mapDispatchToProps ) ( MovieComponent ) ;
15
+ export type MovieComponentProperties = ReturnType < typeof mapStateToProps > & ReturnType < typeof mapDispatchToProps > ;
0 commit comments