aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/App.js
blob: a5a5cbd197dc2454ba0469b11bcddcd6cce0ecd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React from 'react';
import PropTypes from 'prop-types';

import {
  Router,
  Route,
  Switch,
  Redirect,
} from 'react-router-dom';

import { Provider } from 'react-redux';

import Index from './components/page/Index';
import User from './components/page/User';

export default class App extends React.Component {
  static propTypes = {
    store: PropTypes.object.isRequired,
    history: PropTypes.object.isRequired,
  }

  render() {
    const { store, history } = this.props;

    return (
      <Provider store={store}>
        <Router history={history}>
          <Switch>
            <Route exact path="/" component={Index} />
            <Route path="/:type/:value" component={User} />
            <Redirect to="/" />
          </Switch>
        </Router>
      </Provider>
    );
  }
}