{"size": 744, "ext": "js", "max_stars_repo_path": "app/src/App.js", "max_stars_repo_name": "abachman/socket-starter", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/src/App.js", "max_issues_repo_name": "abachman/socket-starter", "max_issues_repo_issues_event_min_datetime": "2021-09-01T06:46:24.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-01T06:46:24.000Z", "max_forks_repo_path": "app/src/App.js", "max_forks_repo_name": "abachman/socket-starter", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 21.2571428571, "max_line_length": 66, "alphanum_fraction": 0.6518817204}
import React from 'react';
import { BrowserRouter as Router, Route } from "react-router-dom";
import { connect } from 'react-redux'

import Chat from './components/Chat'
import Login from './components/Login'
import Actions from './store/actions'

import './stylesheets/App.css';

class App extends React.Component {
  componentDidMount() {
    // connect to websocket on app start
    this.props.dispatch(Actions.connect())
  }

  render() {
    return (
      <Router>
        <Route path="/" exact component={Login} />
        <Route path="/:room" component={Chat} />
      </Router>
    );
  }
}

const mapStateToProps = (state) => {
  return {
    user: state.user,
    room: state.room
  }
}

export default connect(mapStateToProps)(App)
