Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

221
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!