Created
April 8, 2016 22:03
-
-
Save steamIngenius/7864c043bdb8dfd0259fe01c1f8a2fab 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 from 'react'; | |
import { connect } from 'react-redux'; | |
import Vote from './Vote'; | |
import Winner from './Winner'; | |
import pureRender from './pureRender'; | |
// shallow render added using es7 decorator | |
@pureRender | |
export default class Voting extends React.Component { | |
ifThereIsAWinner() { | |
return !!this.props.winner; | |
} | |
render() { | |
return <div className="voting"> | |
{this.ifThereIsAWinner() ? | |
<Winner winner={this.props.winner} /> : | |
<Vote {...this.props} /> | |
} | |
</div>; | |
} | |
} | |
@connect(state => ({ | |
pair: state.getIn(['vote', 'pair']), | |
winner: state.get('winner') | |
})) | |
export class VotingContainer extends Voting {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment