😄Tích hợp công cụ DevelopTool Redux (ok)

https://stackoverflow.com/questions/52946133/unable-to-use-react-native-debugger-after-updating-react-native

Example 1

window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()

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();

C:\Users\Administrator\Desktop\todo\src\index.tsx

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>
);

Last updated

Was this helpful?