traintrape-moi/client/hooks/useLocation.ts

10 lines
413 B
TypeScript

import { LocationObject } from "expo-location"
import { useAppDispatch, useAppSelector } from "./useStore"
import { setLocation } from "@/utils/features/location/locationSlice"
export const useLocation = () => useAppSelector((state) => state.location.location)
export const useSetLocation = () => {
const dispatch = useAppDispatch()
return (location: LocationObject) => dispatch(setLocation(location))
}