Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- import { connect } from 'react-redux';
- import { bindActionCreators } from 'redux';
- import { Route, Switch, withRouter } from 'react-router-dom';
- // Import components here
- // Just showing one for brevity
- import Home from '../components/home/Home';
- import * as appActions from '../actions/app-actions';
- class App extends Component {
- constructor(props) {
- super(props);
- }
- render() {
- return(
- <div>
- <Switch>
- <Route exact path="/member" component={Home} />
- <Route exact path="/member/accounts" component={Accounts} />
- <Route exact path="/member/projects" component={ProjectsList} />
- <Route path="/member/projects/profile/:id" component={ProjectProfile} />|
- <Route exact path="/member/tasks" component={TasksList} />
- <Route path="/member/tasks/profile/:id" component={TaskProfile} />
- </Switch>
- </div>
- );
- }
- }
- function mapStateToProps(state) {
- return {
- member: state.member.memberData
- }
- }
- function mapDispatchToProps(dispatch) {
- return {
- actions: bindActionCreators(appActions, dispatch)
- };
- }
- export default withRouter(connect(mapStateToProps, mapDispatchToProps)(App));
- import React, { Component } from 'react'
- import { connect } from 'react-redux';
- import { bindActionCreators } from 'redux';
- // Actions
- import * as projectProfileActions from '../../../actions/project-profile-actions';
- // Components
- import Desktop from './ProjectProfileDesktop';
- import Mobile from './ProjectProfileMobile';
- class ProjectProfile extends Component {
- constructor(props) {
- super(props);
- };
- componentDidMount() {
- const id = this.props.match.params.id;
- this.props.actions.getData(id);
- }
- render() {
- return (
- <div className="height-100 width-100">
- <div className="height-100 width-100 row row-clean">
- {this.props.ui.isDesktop || this.props.ui.isTablet ? <Desktop />
- : this.props.ui.isMobile ? <Mobile />
- : null}
- </div>
- </div>
- );
- }
- }
- function mapStateToProps(state) {
- return {
- ui: state.app.window
- };
- }
- function mapDispatchToProps(dispatch) {
- return {
- actions: bindActionCreators(projectProfileActions, dispatch)
- };
- }
- export default connect(mapStateToProps, mapDispatchToProps)(ProjectProfile);
- render(
- <Provider store={store}>
- <BrowserRouter history={browserHistory}>
- <StripeProvider apiKey="my_key">
- <App />
- </StripeProvider>
- </BrowserRouter>
- </Provider>,
- document.getElementById('root')
- );
Add Comment
Please, Sign In to add comment