createStore is struck through and marked @deprecated in Redux
createStore shown with a strikethrough and marked @deprecated in the editorShort 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.
Fix it fast
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/toolkit2Match what you see, then jump to its fix
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 build2Fix
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 buildConfirmed by redux.js.org
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" src2Fix
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 devConfirmed by redux.js.org
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:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Web apps
Redux Toolkit warns that a non-serializable value is in an action or state
A non-serializable value was detected in the state
Redux Toolkit logs this warning in development when an action or the state holds something that is not plain data: a Date, class instance, Map, Set, function or Promise.
3 causes, each with a fixWeb apps
TypeScript refuses JSX because the jsx option is not set
TS17004: Cannot use JSX unless the '--jsx' flag is provided.
TypeScript compiles JSX only when you name the file with a .tsx extension and enable the jsx compiler option.
2 causes, each with a fixWeb apps
TypeScript rejects a component that returns an array or other non-Element
Its return type 'Element[]' is not a valid JSX element.
TypeScript before 5.1 required every component to return JSX.Element or null, so arrays, strings and Promises were rejected even though React renders them.
2 causes, each with a fixWeb apps
ESLint says it cannot resolve a path to a module that does exist
Unable to resolve path to module 'react'. import/no-unresolved
import/no-unresolved fails when eslint-plugin-import cannot find the file or package on disk with its resolver.
4 causes, each with a fixWeb apps
ESLint reports no-unused-vars for React components and imports that are used
no-unused-vars reported for a component that is rendered as a JSX tag
ESLint's core no-unused-vars does not see variables used only as JSX tags, so a component imported and rendered as <Hello /> looks unused.
3 causes, each with a fixWeb 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