import React from 'react' import { Switch, Route } from "react-router-dom"; import { connect } from "react-redux"; import { getAllEvents } from "./actions/getAllEvents"; import AdminMainPage from './conteiners/adminMainPage/adminMainPage'; import AdminAddEventPage from './conteiners/adminAddEventPage/adminAddEventPage'; import AdminMyEventsPage from './conteiners/adminMyEventsPage/adminMyEventsPage'; import Home from './conteiners/home/Home'; import Result from './conteiners/result/Result'; import Gallery from './conteiners/gallery/Gallery'; import Reviews from './conteiners/reviews/Reviews'; import Login from './conteiners/login/Login'; import RegistrationPage from './conteiners/registrationPage/RegistrationPage'; import Events from './conteiners/events/Events'; import EventCard from './conteiners/eventCard/EventCard'; import Profile from './conteiners/profile/Profile'; import AdminAddPhotogalarytPage from "./conteiners/adminPhotogalaryPage/adminPhotogalaryPage" export class Router extends React.Component { componentDidMount() { this.props.getAllEvents(); } render() { const { events } = this.props; return(
( )} /> ( )} /> { events.map(event => () } /> ) }
) } } const mapStateToProps = state => { return { events: state.getEvents.events }; }; export default connect( mapStateToProps, { getAllEvents } )(Router);