Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

createStore is struck through and marked @deprecated in Redux

ErrorcreateStore shown with a strikethrough and marked @deprecated in the editor

Short answer

createStore is marked @deprecated since Redux 4.2.0, which only draws a strikethrough in your editor. It still works and will not be removed. Replace it with configureStore from Redux Toolkit, or import legacy_createStore as createStore if you want the tag gone without other changes.

  • Applies to Redux 5, @reduxjs/toolkit 2, React 19, TypeScript 5
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Confirm which package you import it from and which Redux version is installed. The tag is a type-level hint, not a runtime warning, so a build or console message means something else.

    npm ls redux @reduxjs/toolkit
  2. 2Match what you see, then jump to its fix

    1. 1Strikethrough on createStore, and the app runs normallyYour editor shows the @deprecated tag from Redux, not an errorFix
    2. 2You still call createStore, combineReducers, applyMiddleware and the DevTools enhancer by handThe store should move to Redux Toolkit's configureStoreFix

What does the error look like?

  • createStore shown with a strikethrough and marked @deprecated in the editor

Cause 1 of 2

Your editor shows the @deprecated tag from Redux, not an error

1Check

Run the app. The Redux docs say the tag is only a visual indicator, with no runtime errors or warnings, and that createStore will never be removed.

npm run build

2Fix

You can leave it. If you want the strikethrough gone with no other change, use the identical function without the tag through an aliased import.

import { legacy_createStore as createStore } from 'redux'

3Verify

The strikethrough disappears and behaviour is the same.

npm run build

Confirmed by redux.js.org

Did this fix it?

Cause 2 of 2

The store should move to Redux Toolkit's configureStore

1Check

Look for the manual setup that configureStore replaces.

grep -rnE "createStore|combineReducers|applyMiddleware" src

2Fix

Install Redux Toolkit and replace the whole block with one call. Passing an object as reducer calls combineReducers for you, adds the thunk middleware, dev-time mistake checks and the DevTools connection. Existing reducers and middleware keep working as they are.

npm install @reduxjs/toolkit

// store.js
import { configureStore } from '@reduxjs/toolkit'
import postsReducer from './reducers/postsReducer'
import usersReducer from './reducers/usersReducer'

export const store = configureStore({
  reducer: {
    posts: postsReducer,
    users: usersReducer,
  },
})

3Verify

State keeps the shape { posts, users }. Start the app and dispatch an action.

npm run dev

Confirmed by redux.js.org

Did this fix it?

How do I stop it coming back?

  • Start new stores with configureStore, and type RootState and AppDispatch from the store itself.
  • Do not treat an editor strikethrough as a runtime failure; check the console first.
  • Migrate slices later; changing only the store setup is a safe first step.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Web apps

TypeScript rejects MUI Data Grid columns that set a type

A TypeScript error inside a column's renderCell callback

A columns array declared without a type is inferred with type as a plain string, which the Data Grid's column type union does not accept.

2 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.