Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

233
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda