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

236
Vistas
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 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