23 lines
602 B
JavaScript
23 lines
602 B
JavaScript
import { connect } from 'react-redux';
|
|
|
|
import { setActiveEvent } from '../actions/activeEvent.js';
|
|
import { fetchEvents } from '../actions/events.js';
|
|
import { getEventsAsList } from '../selectors/events.js';
|
|
|
|
import Events from './Events.js';
|
|
|
|
const matchStateToProps = (state) => {
|
|
const events = getEventsAsList(state);
|
|
return { events };
|
|
};
|
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
fetchEvents: () => dispatch(fetchEvents()),
|
|
setActiveEvent: (eventId) => dispatch(setActiveEvent(eventId)),
|
|
});
|
|
|
|
export default connect(
|
|
matchStateToProps,
|
|
mapDispatchToProps,
|
|
)(Events);
|