Last active
July 26, 2019 19:27
-
-
Save Natanagar/0d98f4f6d1ffc0bb114675158abfb36e to your computer and use it in GitHub Desktop.
top component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect } from 'react'; | |
import { connect } from 'react-redux'; | |
import { Router } from '@reach/router'; | |
import { Footer } from './components/Footer/Footer'; | |
import { Navigation } from './components/Navigation/Navigation'; | |
import { Employer } from './components/Employer/Employer'; | |
import { Employee } from './components/Employee/Employee'; | |
import { mapStartLoading } from './actions/index'; | |
import { mapParams } from './redux-sagas/MapSaga'; | |
import './App.css'; | |
const App = ({ | |
mapStart, dispatch, marker, map, | |
}) => { | |
useEffect(() => dispatch(mapStart), [dispatch, mapStart]); | |
return ( | |
<div className="App"> | |
<div id="map" /> | |
<Navigation /> | |
<Router> | |
<Employer path="company" /> | |
<Employee path="hiring" /> | |
</Router> | |
<Footer /> | |
</div> | |
); | |
}; | |
const mapStateToProps = ({ MapReducer }) => { | |
const { marker, map } = MapReducer; | |
return { | |
marker, | |
map, | |
}; | |
}; | |
const mapDispatchToProps = dispatch => ({ | |
mapStart: () => dispatch(mapStartLoading()), | |
dispatch, | |
}); | |
export default connect(mapStateToProps, mapDispatchToProps)(App); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment