import { useDispatch , useSelector } from 'react-redux' ; import { RootState } from '../../store' ; import { DepthThemeState , setThemeProperties , } from '../../store/depth-theme/action' ; export interface MapThemeHookType { themeIdx ? : number ; checkHandler : ( index : number ) => void ; } function useMapTheme ( ) { const { themeIdx } = useSelector < RootState > ( ( state ) => state . depthTheme ) as DepthThemeState ; const dispatch = useDispatch ( ) ; const checkHandler = ( index ) => { dispatch ( setThemeProperties ( { themeIdx : index } ) ) ; } ; return { themeIdx , checkHandler } ; } export default useMapTheme ;