Untitled
plain_text
2 months ago
757 B
1
Indexable
Never
import { createSlice } from '@reduxjs/toolkit' export const UserLocationSlice= createSlice({ name: 'UserLocation', initialState: { coordinates: [0,0], heading:-1 }, reducers: { setUserLocationHeading: (state, action) => { state.heading = action.payload; // Set the value in state }, setUserLocationCoordinates: (state, action) => { state.coordinates = action.payload; // Set the value in state } } }) export const {setUserLocationHeading,setUserLocationCoordinates} = UserLocationSlice.actions export const userLocationCoordinates= state=>state.UserLocation.coordinates export const userLocationHeading=state=>state.UserLocatoin.heading export default UserLocationSlice.reducer