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

222
Visualizações
Uncaught ReferenceError: Cannot access 'FETCH_MESSAGES' before initialization

I am getting error, not during compilation, but in my browser, I have attached the files here

message.js reducer file

import store from './index';

// ACTION TYPES
const FETCH_MESSAGES = "FETCH_MESSAGES";

// ACTIONS
export const fetchMessages = ( id ) => {
    console.log(store.getState());
    return {
        type: FETCH_MESSAGES,
        payload: id
    }
}

// REDUCERS
export default function reducer( state = -1, action ) {
    switch(action.type) {
        case FETCH_MESSAGES :
            return action.payload;
        default:
            return state;
    }
}

index.js

import { createStore, combineReducers, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import chatReducer from './chat';
import messageReducer from './messages';
const reducer = combineReducers({
    chatStore : chatReducer,
    messageStore : messageReducer,
});
const store = createStore(reducer, applyMiddleware(thunk));
export default store;

Error Message Scrrenshot of error message

about 4 years ago · Santiago Trujillo
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