【发布时间】:2022-01-16 20:40:51
【问题描述】:
我正在开发一个创建 google chrome 扩展程序的项目。我正在尝试添加 redux-saga 中间件以使用 saga debounce。但是,我收到一条错误消息:参数类型不可分配为“Store
在后台.ts中
const middleware = [saga]
const store = createStore(reducer, initialState)
// a normal Redux store
const storeWithMiddleware = applyMiddleware(store, ...middleware)
wrapStore(storeWithMiddleware, { portName: 'bla' })
在 popup.tsx 中
const store = new Store({ portName: 'bla' })
// wait for the store to connect to the background page
store
.ready()
.then(() => {
// The store implements the same interface as Redux's store
// so you can use tools like `react-redux` no problem!
const root = document.createElement('div')
document.body.appendChild(root)
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
root
)
})
.catch((e) => console.log(e))
//});
export default store
【问题讨论】:
标签: google-chrome-extension react-redux redux-saga chrome-extension-manifest-v3