Javascript 用createProvider替换redux提供程序会引发错误
我有一个带有上下文提供程序的系统,它在一个商店中正常工作:Javascript 用createProvider替换redux提供程序会引发错误,javascript,reactjs,redux,react-redux,Javascript,Reactjs,Redux,React Redux,我有一个带有上下文提供程序的系统,它在一个商店中正常工作: import { connect, Provider } from 'react-redux' import sfc from './component' const mapStateToProps = (state, ownProps) => ({ host: ownProps.host }) const ConnectedSfc = connect(mapStateToProps)(sfc) export cons
import { connect, Provider } from 'react-redux'
import sfc from './component'
const mapStateToProps = (state, ownProps) => ({
host: ownProps.host
})
const ConnectedSfc = connect(mapStateToProps)(sfc)
export const AppMainView = props => (
<Provider store={props.host.getStore()}>
<ConnectedSfc host={props.host} />
</Provider>
)
并将storeKey
设置为连接选项
但是,当我运行项目时(仅使用此小更改),会抛出一个错误:
Uncaught Invariant Violation: Could not find "store" in either the context or props of "Connect(sfc)".
Either wrap the root component in a <Provider>, or explicitly pass "store" as a prop to "Connect(sfc)".
未捕获不变冲突:在“连接(sfc)”的上下文或道具中找不到“存储”。
将根组件包装在中,或者将“store”作为prop显式传递给“Connect(sfc)”。
我做错了什么
Uncaught Invariant Violation: Could not find "store" in either the context or props of "Connect(sfc)".
Either wrap the root component in a <Provider>, or explicitly pass "store" as a prop to "Connect(sfc)".