Giai quyết lỗi (để tích hợp công cụ DevelopTool Redux)
It looks like you are passing several store enhancers to createStore()
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { createStore, compose, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import thunk from 'redux-thunk';
import appReducers from './reducers/index';
const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
var store = createStore(appReducers,composeEnhancer(applyMiddleware(thunk)),);
ReactDOM.render(
<Provider store={store}>
<App/>
</Provider>,
document.getElementById('root'));
serviceWorker.unregister();
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import { createStore, compose,applyMiddleware } from 'redux';
import myReducer from './reducers/index';
import { Provider } from 'react-redux';
declare global {
interface Window {
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?: typeof compose;
}
}
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
var store = createStore(myReducer,composeEnhancers(applyMiddleware()));
const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.render(
<React.StrictMode>
<Provider store={store}><App /></Provider>
</React.StrictMode>
);