Skip to content

Instantly share code, notes, and snippets.

@funador
Last active July 21, 2018 16:19
Show Gist options
  • Save funador/3eb20434f37047c928095a2acb474048 to your computer and use it in GitHub Desktop.
Save funador/3eb20434f37047c928095a2acb474048 to your computer and use it in GitHub Desktop.
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