Last active
July 21, 2018 16:19
-
-
Save funador/3eb20434f37047c928095a2acb474048 to your computer and use it in GitHub Desktop.
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, { Component } from 'react' | |
| import io from 'socket.io-client' | |
| import FontAwesome from 'react-fontawesome' | |
| import Footer from './Footer' | |
| import './App.css' | |
| const API_URL = 'http://127.0.0.1:8080' | |
| const socket = io(API_URL) | |
| export default class App extends Component { | |
| constructor() { | |
| super() | |
| this.state = { | |
| user: {}, | |
| disabled: '' | |
| } | |
| this.popup = null | |
| } | |
| componentDidMount() { | |
| socket.on('user', user => { | |
| this.popup.close() | |
| this.setState({user}) | |
| }) | |
| } | |
| // Custom methods and render to follow | |
| // .... | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment