我把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
方法打了断点,发现没执行。
求助
###试试这样呢?
interface NewModalType extends ModalType {
content: () => ReactNode
}
Moadl.show(params: NewModalType);
// FwModal.show
{params.content} --- > <param.content />
还是有点问题, 这样会更好点?
interface NewModalType<P> extends ModalType {
Component: React.Component<P, any>,
props: P
}
// FwModal.show
<param.Component {...param.props} />