brutal-legends/src/containers/sort-select.js
Anders Ytterström 3d06ff065d Sort albums by year, artist or id
* The store gets a sort key.
 * Action creators and actions are added to set sort key.
 * A component is added which dispatches a reducer to update the state.
 * Album list get the sort key from the state and sort albums on render.
2018-11-21 14:58:11 +01:00

14 lines
413 B
JavaScript

import React from 'react';
import { connect } from 'react-redux';
import SortSelect from '../components/sort-select';
import {setSortKey} from "../actions";
const mapStateToProps = state => ({
value: state.sortKey
});
const mapDispatchToProps = (dispatch) => ({
handleOnChange: (key) => dispatch(setSortKey(key))
});
export default connect(mapStateToProps, mapDispatchToProps)(SortSelect);