import React from 'react' ; import { DiagramState , nodeSelectionSelector } from '../reducers/diagramReducer' ; import { connect } from 'react-redux' ; interface SelectionDetailsStateProps { nodes : string [ ] ; } const mapStateToProps = ( state ) : SelectionDetailsStateProps => { return { nodes : nodeSelectionSelector ( state ) } ; } ; const SelectionDetails = ( { nodes } ) => { const message = nodes . reduce ( ( result , current ) => result + ' ' + current , '' ) ; return < div > { nodes . length === 0 ? 'No selection' : 'Selection: ' + message } < /div>; } ; export default connect ( mapStateToProps ) ( SelectionDetails ) ;