Skip to content

Instantly share code, notes, and snippets.

@isuvorov

isuvorov/wtf.jsx

Created Oct 26, 2016
Embed
What would you like to do?
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
You can’t perform that action at this time.