import React, { Component } from 'react';
import { connect } from 'react-redux';
import { selectBook } from '../actions/index';
import { bingActionCreators } from 'redux';



class BookList extends Component {
    renderList() {
        return this.props.books.map((book) => {
            return (
            <li key={book.title} className="list-group-item">{book.title}</li>
            );
        });
    }
    
    render() {
        return (
            <ul className="list-group col-sm-4">
                {this.renderList()}
            </ul>
        )
    }
}

function mapStateToProps(state) {
    // Whatever is returned from here
    // shows up as props inside of BookList
    return {
        books: state.books
    };
}

// Anything returned from teh function will end up as props
// on the BookList container

function mapDispatchToProps(dispatch) {
    // Whenever selectBook is called, the result should be passed 
    // to all of our reducers

    return bingActionCreators({ selectBook: selectBook }, dispatch);
}

// Promote BookList from a component to a container - it needs to know 
// about this new dispatch method selectBook. Make it available 
// as a prop.
export default connect(mapStateToProps, mapDispatchToProps)(BookList);
@@ -78,99 +78,8 @@
 x';%0A
-import %7B selectBook %7D from '../actions/index';%0Aimport %7B bingActionCreators %7D from 'redux';%0A
 %0A%0A%0Ac
@@ -641,459 +641,8 @@
 %0A%7D%0A%0A
-// Anything returned from teh function will end up as props%0A// on the BookList container%0A%0Afunction mapDispatchToProps(dispatch) %7B%0A    // Whenever selectBook is called, the result should be passed %0A    // to all of our reducers%0A%0A    return bingActionCreators(%7B selectBook: selectBook %7D, dispatch);%0A%7D%0A%0A// Promote BookList from a component to a container - it needs to know %0A// about this new dispatch method selectBook. Make it available %0A// as a prop.%0A
 expo
@@ -679,28 +679,8 @@
 rops
-, mapDispatchToProps
 )(Bo

Revert "mapped actions to dispatch"