import React from 'react'; import ReactDOM from 'react-dom'; import io from 'socket.io-client'; import Board from './board'; import './index.css'; const ENDPOINT = "http://localhost:4001"; class NameForm extends React.Component { constructor(props) { super(props); this.state = {value: ''}; this.handleChange = this.handleChange.bind(this); this.handleSubmit = this.handleSubmit.bind(this); this.onSubmit = props.onSubmit; } handleChange(event) { this.setState({value: event.target.value}); } handleSubmit(event) { this.onSubmit(this.state.value); event.preventDefault(); } render() { return (
); } } class Game extends React.Component { constructor(props) { super(props); this.state = { board: null, socket: io(ENDPOINT), gameKey: null, }; this.state.socket.on("FromAPI", data => { console.log(data); this.setState({ board: null, }); this.setState({ board: (