import React from "react"; import { connect } from "react-redux"; const renderStatus = status => { if (status == "viewing") { return ( viewing ); } else { return ( offline ); } }; const GameInfo = props => { return (

Playing {props.opponent} {renderStatus(props.opponentStatus)}

); }; const mapStateToProps = state => { return { opponent: state.opponent, opponentStatus: state.opponentStatus, }; }; export default connect(mapStateToProps)(GameInfo);