traintrape-moi/client/hooks/useTrain.ts

9 lines
372 B
TypeScript

import { downloadTrains, TrainsPayload } from "@/utils/features/train/trainSlice"
import { useAppDispatch, useAppSelector } from "./useStore"
export const useTrain = () => useAppSelector((state) => state.train)
export const useDownloadTrains = () => {
const dispath = useAppDispatch()
return (trainsData: TrainsPayload) => dispath(downloadTrains(trainsData))
}