我把antd Modal
封装成了函数调用的方式
interface NewModalType extends ModalType {
content: ReactNode
}
Moadl.show(params: NewModalType)
我再调用时给content
传入了另一个react
组件,结果报错:
Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>
根据错误提示给show
方法中<Modal />
包了一层<Provider store={store}></Provider>
const store = createStore(() => {});
现在有一个问题是:ExecutionPlan.tsx
文件中的getTemplateDetails
方法被调用了,但是dispatch这个请求却没发出去,感觉这行代码没被执行,我在timingPlan
这个model
中给getTimingPlanDetails
方法打了断点,发现没执行。据我推断是将这个模态框组件封装后拿不到store导致的
我得问题是: 为什么会这样?该怎么处理?粗体或者说我这样封装是否合理,烦请给出解决方案.
试试这样呢?
还是有点问题, 这样会更好点?