Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
redux-toolkit typo error action is not a function

I've looked on other posts and it seemed to be a naming export thing, but I looked over and over my code and can't figure it out. I will appreciate any advice.

this is the error I'm getting:

TypeError: (0 , _redux_wetherSlice__WEBPACK_IMPORTED_MODULE_2__.setLocalLatitude) is not a function
    at localWether.js:14

slice component

import { createSlice } from "@reduxjs/toolkit";

export const wetherSlice = createSlice({
  name: "wether",
  initialState: {
    localLocation: {
      latitude: "",
      longitude: "",
    },
    reducers: {
      setLocalLatitude: (state, action) => {
        state.localLocation.latitude = action.payload;
      },
      setLocalLongitude: (state, action) => {
        state.localLocation.longitude = action.payload;
      },
    },
  },
});

export const { setLocalLongitude, setLocalLatitude } = wetherSlice.actions;

export default wetherSlice.reducer;

react component

import { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { setLocalLatitude, setLocalLongitude } from "../../redux/wetherSlice";

const LocalWether = () => {
  const dispatch = useDispatch();
  const { localLocation } = useSelector((state) => state.wether);

  useEffect(() => {
    navigator.geolocation.getCurrentPosition((position) => {
      try {
        console.log(position);
        dispatch(setLocalLatitude(position.coords.latitude));
        dispatch(setLocalLongitude(position.coords.longitude));
      } catch (err) {
        console.log(err);
      }
    });
  }, []);

  console.log(localLocation);

  return <button>Click For Location</button>;
};

export default LocalWether;

store

import { configureStore } from "@reduxjs/toolkit";
import wetherReducer from "../redux/wetherSlice";

const store = configureStore({
  reducer: { wether: wetherReducer },
});

export default store;
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!