Skip to content

Instantly share code, notes, and snippets.

@isuvorov
Created October 26, 2016 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isuvorov/162a62720d6ddf66c7e5cd023d8a75cb to your computer and use it in GitHub Desktop.
Save isuvorov/162a62720d6ddf66c7e5cd023d8a75cb to your computer and use it in GitHub Desktop.
export default class CoursePage extends Component {
componentDidMount() {
this.startLoad()
}
startLoad() {
const params = this.props.params
this.course = this.props.user.api.getCourse(params.courseId)
}
isLoaded() {
return Promise.all([
this.props.user.loading(),
this.course,
])
}
getLoadedData() {
return {
user: this.props.user,
course: this.course,
}
}
loadedRender() {
return <CoursePageView {...this.props} {...this.getLoadedData()} />
}
render() {
if (!this.isLoaded()) return <Preloader />
return this.loadedRender()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment