React Redux <connector>

时间:2017-07-31 17:05:24

标签: javascript reactjs redux

如何使这部分代码与新版本的redux一起使用? 这与reudx&lt; 1.0版https://github.com/reactjs/redux/releases/tag/v1.0.0-rc 但现在来自Connector的{​​{1}} - react-redux 是否有可能使这项工作?

部分代码

undefined

2 个答案:

答案 0 :(得分:3)

试试这个

import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

class Map extends React.Component
{
//Your Map component
}

const mapStateToProps = (state = {}) => {
    return {
        center: state.map.get('mapInfo').get('center'),
                            zoom: state.map.get('mapInfo').get('zoom'),
                            markers: state.map.get('dataFiltered'),
                            visibleRowFirst: state.map.get('tableRowsInfo').get('visibleRowFirst'),
                            visibleRowLast: state.map.get('tableRowsInfo').get('visibleRowLast'),
                            maxVisibleRows: state.map.get('tableRowsInfo').get('maxVisibleRows'),
                            hoveredRowIndex: state.map.get('tableRowsInfo').get('hoveredRowIndex'),
                            openBallonIndex: state.map.get('openBalloonIndex')
    }
}

const mapDispatchToProps = (dispatch) => {
    return {
        actions: bindActionCreators(mapActions, dispatch)
    }
}

export default connect(mapStateToProps, mapDispatchToProps)(Map);

答案 1 :(得分:-1)

我认为包已更改为react-redux。尝试导入。