createStore 是@deprecated 所以我试图用 configurationStore 替换

createStore is @deprecated so im trying to replace with configurationStore

createStore 已被@deprecated,所以我试图用 configurationStore 替换,我认为来自我的集群的 post 数据因此没有显示

```

import React from 'react';
import ReactDom from 'react-dom/client';
import { Provider } from 'react-redux';
import {createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';

import reducers from "./reducers";

import App from './App'

const store = createStore(reducers, (compose(applyMiddleware(thunk))))
const root = ReactDom.createRoot(document.getElementById("root"));

root.render(
    <Provider store={store}>
        <App />
    </Provider>
);


And im trying to do it like this:

    

import React from 'react';
import ReactDom from 'react-dom/client';
import { Provider } from 'react-redux';
import { applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import { configureStore } from '@reduxjs/toolkit'

import reducers from "./reducers";

import App from './App'

const store = configureStore(reducers, (compose(applyMiddleware(thunk))))
const root = ReactDom.createRoot(document.getElementById("root"));


root.render(
<Provider store={store}>
    <App />
</Provider>
);

```

当然没用,我在想办法

你会做

const store = configureStore({ reducer: reducers })

thunk 中间件自动激活。 composeapplyMiddleware 不再需要了。 combineReducers.

也是

如果你有

const reducers = combineReducers({
  a: reducerA,
  b: reducerB
})

你也可以直接做

const store = configureStore({ 
  reducer: {
    a: reducerA,
    b: reducerB
  }
})

如果您仍在使用 createStore,那意味着您通常使用的是过时的 Redux 风格,其代码大约​​是现代 Redux 代码的 4 倍。

现代 Redux 不使用 switch..case reducer、ACTION_TYPE 常量、不可变的 reducer 逻辑、hand-written action creators 或 connect & mapStateToProps。您可能被过时的教程误导了。

我强烈建议您遵循 official Redux tutorial,这将使您了解现代 Redux,并最终使代码更加简洁和易于维护。