无法读取未定义的属性“名称”:redux-reactstrap-modal

时间:2019-07-31 08:06:26

标签: reactjs webpack babel

我正在为项目使用redux-reactstrap-modal。 当我配置webpack和babel时,网页上出现波纹管错误。

enter image description here

这是我的package.json

   this.backgroundMode.moveToForeground();
   this.backgroundMode.moveToBackground();

Playmodel.js

"dependencies":{
    "babel": "^6.23.0",
    "babel-core": "^6.26.3",
    "babel-loader": "^8.0.6",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "react": "^16.8.4",
    "react-redux": "^5.0.7",
    "react-scripts": "1.1.1",
    "redux-reactstrap-modal": "^1.0.3",
    "webpack": "^3.11.0"
}

1 个答案:

答案 0 :(得分:0)

您是否可以认为这是PlayModal组件的替代品,在对组件的导出语句进行更新的地方:

import React, { Component } from 'react';
import reduxDialog, { closeDialog, openDialog } from 'redux-reactstrap-modal';
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import { compose } from 'recompose';

class PlayModal extends Component {

 render() {
   return (
     <div>
       {
         /** SOME JSX */
       }
     </div>
   )
 }
}


function mapDispatchToProps(dispatch) {
    return bindActionCreators({ closeDialog, openDialog }, dispatch);
}

const WithDialog = reduxDialog(connect, { name: 'MODAL_PLAY',backdrop:'static'})(PlayModal);
const ConnectedWithDialog = connect(null, mapDispatchToProps)(WithDialog);

export default ConnectedWithDialog;