// @flow
import * as React from 'react';
import { Route, Switch } from 'react-router-dom';
import ContactRoute from './ContactRoute';
import PageNotFoundRoute from '../pageNotFound/PageNotFoundRoute';

const contactRoute = ({ match }: { match: { path: string } }) => (
  <Switch>
    <Route exact path={`${match.path}`} component={ContactRoute} />
    <Route component={PageNotFoundRoute} />
  </Switch>
);

export default function Contact() {
  return <Route path="/contact" component={contactRoute} />;
}

// @flow
import * as React from 'react';
import { Route, Switch } from 'react-router-dom';
import ContactRoute from './ContactRoute';
import RouteWrapper from 'app/components/RouteWrapper';
import { UserContext } from 'app/routes/app/AppRoute';
import PageNotFoundRoute from '../pageNotFound/PageNotFoundRoute';

const contactRoute = ({ match }: { match: { path: string } }) => (
  <UserContext.Consumer>
    {({ currentUser, loggedIn }) => (
      <Switch>
        <RouteWrapper
          exact
          path={`${match.path}`}
          Component={ContactRoute}
          passedProps={{ currentUser, loggedIn }}
        />
        <Route component={PageNotFoundRoute} />
      </Switch>
    )}
  </UserContext.Consumer>
);

export default function Contact() {
  return <Route path="/contact" component={contactRoute} />;
}

Fix user state in contact form
Fix user state in contact form
