2017-07-31 13 views
0

この部分をreduxの新しいバージョンで使用するにはどうすればよいですか? これはreudxと一緒に働いています< 1.0バージョンhttps://github.com/reactjs/redux/releases/tag/v1.0.0-rc しかしConnectorreact-reduxからundefined この作業を行うことは可能ですか?React Redux <Connector>

私はパッケージが-Reduxのを反応させるために変更されたと思うのコード

import { Connector } from 'redux/react; 

<Connector select={state => ({ 
          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') 
         })}> 
          {({dispatch, ...mapProps}) => (
           <Map {...mapProps} 
            {...bindActionCreators(mapActions, dispatch)} 
           /> 
          )} 
         </Connector> 
+0

なぜ、このような古いバージョンをお試しください! 'Connector'ではなく' Provider'を意味しましたか?また、IIRCは 'connect(mapStateToProps、mapDispatchToProps)'でなければなりません。 – Li357

+0

@AndrewLi、いいえ、私は 'Connector' - >ここには例が https://github.com/istarkov/google-map-react-examples/blob/master/web/flux/components/examples/x_main/main_map_pageです。 jsx –

+0

今後のサポートのためRedux、React Redux、Reactのアップグレードをお勧めします。 React Redux Li357

答えて

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

の一部。それをインポートしてみてください。

+0

回答ありがとうございます。試しました - dsntの仕事 –

+0

これらのドキュメントによると、Connectorはhttps://github.com/reactjs/redux/releases/tag/v1.0.0-rcに移動されました。また、 'redux/react 'のインポートにはアポストロフィがありません' – Byrd

関連する問題