实现Redux开发工具

4c8rllxm  于 2022-11-12  发布在  其他
关注(0)|答案(1)|浏览(146)

我在这篇文章中做了确切的指示:https://medium.com/@samueldinesh/setting-up-redux-devtools-a-simple-guide-3b386a6254fa
我得到的错误是:

这是我的代码:

import {StrictMode} from 'react'
import {createRoot} from 'react-dom/client'
import { createStore } from 'redux'
import { composeWithDevTools } from 'redux-devtools-extension'
import App from './App'
import './styles/globals.css'
import { store } from './store/store'
import { Provider } from 'react-redux'
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'

const rootElement = document.querySelector('#main')
const root = createRoot(rootElement)

const currentStore = createStore(
  store,
  composeWithDevTools()
)

root.render(
  <StrictMode>
    <Provider store={currentStore}>
      <Router>
        <Routes>
          <Route path="/*" element={<App />} />
        </Routes>
      </Router>
    </Provider>
  </StrictMode>
)

我错过了什么?

s4chpxco

s4chpxco1#

你正经过一家商店。你应该经过rootReducer

const currentStore = createStore(
  store,
  composeWithDevTools()
)

//显示链接

const currentStore = createStore(
  rootReducer,
  composeWithDevTools()
)

相关问题