在umi 的项目中无法使用redux-modal

栏目: IT技术 · 发布时间: 5年前

内容简介:app.js 注入modalReducer`export const dva = {config: {

app.js 注入modalReducer

`export const dva = {

config: {

extraReducers: {

modal: modalReducer,

},

onError(e) {

e.preventDefault();

if (sentry) {

console.log('sentry', e.message);

}

},

// 注释以下可关闭logger

// onAction: createLogger(loggerConfig),

},

};`

modal.jsx

`import React from 'react';

import { connect } from 'dva';

import { connectModal } from 'redux-modal';

import { Modal } from 'antd';

function FollowUp(props:any) {

console.log(props);

function cancel (){

props.handleHide()

}

return (

<Modal

title="实战"

visible={true}

onCancel={() => {}}

<div>hello world</div>

) }

// export default connect((state:any) => state)(FollowUp);

export default connectModal({

name: 'follow-up',

destroyOnHide: true,

})(FollowUp);

`

ErrorBoundary.jsx

return ( <> {this.props.children} <Modals/> </> )

报告错误:

Error: Could not find "store" in the context of "Connect(ConnectModal(FollowUp))". Either wrap the root component in a , or pass a custom React context provider to and the corresponding React context consumer to Connect(ConnectModal(FollowUp)) in connect options.


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

点石成金

点石成金

[美] 史蒂夫·克鲁克 / De Dream' / 机械工业出版社 / 2006-8 / 39.00元

可用性设计是Web设计中最重要也是最困难的一项任务。《点石成金》的作者根据自己多年从业的经验,剖析用户的心理,在用户使用的模式、为浏览进行设计、导航设计、主页布局、可用性测试等方面提出了许多独特的观点,并给出了大量简单、易行的可用性设计的建议。这本书短小精悍,语言轻松诙谐,书中穿插大量色彩丰富的屏幕截图、趣味丛生的卡通插图以及包含大量信息的图表,使枯燥的设计原理变得平易近人。 此书适合从事W......一起来看看 《点石成金》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具