Created
November 3, 2015 19:19
-
-
Save lesniakania/7a926500f58a5f09ee59 to your computer and use it in GitHub Desktop.
This file contains 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 Rate from './Rate'; | |
import Submission from './Submission'; | |
import { performRating, fetchSubmission } from '../actions_creators/SubmissionActionsCreator'; | |
class SubmissionPage extends React.Component { | |
static fetchData(dispatch, params) { | |
return dispatch(fetchSubmission(params.id)); | |
} | |
performRating(value) { | |
this.props.dispatch(performRating(this.props.submission, value)); | |
} | |
render() { | |
return ( | |
<div> | |
<Submission submission={this.props.submission} /> | |
<Rate rate={this.props.submission.rate} performRating={this.performRating.bind(this)} /> | |
</div> | |
) | |
} | |
}; | |
function select(state) { | |
const id = state.router.params.id; | |
return { | |
submission: state.submissions[id] || {} | |
}; | |
} | |
export default connect(select)(SubmissionPage); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment