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

265
Visualizações
TypeError: store.getState is not a function (redux)

I keep on getting this error:

TypeError: store.getState is not a function

I think the problem might be in my store.js but I'm not really sure where.

Below are the codes:

root reducer.js

import { combineReducers } from "redux";

import userReducer from "./User/userReducer";

export default combineReducers({
  user: userReducer,
});

root saga.js

import { all, call } from "redux-saga/effects";

import userSaga from "./User/user.saga";

//generator function
export default function* rootSaga() {
  //to pass our sagas
  yield all([call(userSaga)]);
}

store.js

import { createStore, applyMiddleware } from "redux";
import logger from "redux-logger";
import thunk from "redux-thunk";
import createSagaMiddleWare from "redux-saga";
import { persistStore } from "redux-persist";

import rootReducer from "./rootReducer";
import rootSaga from "./rootSaga";

const sagaMiddleware = createSagaMiddleWare();
export const middleWares = [thunk, sagaMiddleware, logger];

export const store = createStore(rootReducer, applyMiddleware(...middleWares));
sagaMiddleware.run(rootSaga);

//----
export const persist = persistStore(store);

export default { store, persist };

index.js

import { BrowserRouter } from "react-router-dom";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
import { Provider } from "react-redux";
import store from "./Redux/store";

ReactDOM.render(
  <React.StrictMode>
    <Provider store={store}>
      <BrowserRouter>
        <App />
      </BrowserRouter>
    </Provider>
  </React.StrictMode>,
  document.getElementById("root")
);
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You import store wrong way:

import { store } from "./Redux/store";
about 4 years ago · Juan Pablo Isaza Relatório
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