import { Dispatch } from 'redux' ; import { RootState } from 'store' ; import * as quizActions from 'store/quiz/actions' ; import * as quizAsyncactions from 'store/quiz/async-actions' ; import * as resultsAsyncactions from 'store/results/async-actions' ; import { QuizActions , Answer } from 'store/quiz/types' ; import { ResultsActions , Results } from 'store/results/types' ; export const mapStateToProps = ( { quiz } ) => { const { question , answers } = quiz ; return { question , answers } ; } ; type MultipleDispatch = Dispatch < QuizActions > & Dispatch < ResultsActions > ; export const mapDispatcherToProps = ( dispatch ) => ( { getAndSetQuestionByIndex : async ( questionIndex ) => { await quizAsyncactions . getAndSetQuestionByIndex ( dispatch , questionIndex ) ; } , addAndSetResults : ( results ) => resultsAsyncactions . addAndSetResults ( dispatch , results ) , addToResultsHistoryById : async ( id ) => { await resultsAsyncactions . addToResultsHistoryById ( dispatch , id ) ; } , addAnswer : ( answer ) => dispatch ( quizActions . addAnswer ( answer ) ) , clearQuizData : ( ) => dispatch ( quizActions . clearQuizData ( ) ) , } ) ;