Redux-Logger - 'reducer' is not defined


I'm trying to learn how to use Redux-Logger (dont know whether LogRocket is required, considering it hasnt been updated in years to state its needed but I digress )

According to the usage, the basic implementation is

import { applyMiddleware, createStore } from 'redux';

// Logger with default options
import logger from 'redux-logger'
const store = createStore(

// Note passing middleware as the third argument requires redux@>=3.1.0

I added that into my code and it tells me

'reducer' is not defined

What am I missing here?

1 answer

  • answered 2022-01-25 09:28 phry

    If someone in the future stumbles about this: the documentation of redux-logger shows an outdated example using an outdated style of Redux.

    In modern Redux, you would be using configureStore instead, as shown by this example from the Redux-Toolkit documentation:

    import { configureStore } from '@reduxjs/toolkit'
    import logger from 'redux-logger'
    import rootReducer from './reducer'
    const store = configureStore({
      reducer: rootReducer,
      middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(logger),

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum