>

CODEMASTERYLAB

IDE PLATFORM
CoursesCommunity BlogsKnowledge GraphQuizzesInterview Prep

Sign in to track progress & earn XP

Sign In Create Account
>
Code Mastery Lab

Code Mastery Lab

Sign In

The Redux Store — Subscriptions, Middleware, and Action Creators

Question 1 / 1

0:00
Core
Medium

A developer adds logger and saver middleware to their store:

const store = createStore(
  combineReducers({ colors, sort }),
  initialState,
  applyMiddleware(logger, saver)
)

After adding the middleware, store.dispatch(addColor('Red', '#FF0000')) is called. The logger correctly prints the prev and next state. But the developer checks localStorage['redux-store'] and finds it contains the state from before the dispatch — the new color is not saved. What is the likely bug in the saver middleware?