Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

232
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda