import React, {Component} from 'react'; export default class RoomListItem extends Component { constructor(props){ super(props); this.state={ term:'' } this.onInputChange = this.onInputChange.bind(this); this.buttonClickHandler = this.buttonClickHandler.bind(this); } onInputChange(event) { this.setState( { term: event.target.value }); } buttonClickHandler(event){ this.props.socket.emit('joinRoom', {roomName: this.props.roomName, password: this.state.term}); } render(){ if (this.props.private === false){ console.log("The public listItem was called") return(
  • {this.props.roomName}'s Room {this.props.occupancy}/{this.props.capacity} Public
  • ) } else { console.log("the private listItem was called") return(
  • {this.props.roomName}'s Room {this.props.occupancy}/{this.props.capacity} Private
  • ) } } }