forked from rage/java-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCrowdSorcerer.js
More file actions
38 lines (32 loc) · 939 Bytes
/
CrowdSorcerer.js
File metadata and controls
38 lines (32 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React, { lazy, Suspense } from "react"
import "crowdsorcerer/dist/app.css"
import withSimpleErrorBoundary from "../util/withSimpleErrorBoundary"
const CrowdSorcerer = lazy(() => import("crowdsorcerer"))
class CrowdSorcererWrapper extends React.Component {
state = {
render: false,
}
componentDidMount() {
this.setState({ render: true })
}
render() {
if (!this.state.render) {
return <div>Loading...</div>
}
const assignmentId = this.props.id
const exercises = this.props.exercisecount
const review = this.props.peerreview
return (
<div id={`crowdsorcerer-${assignmentId}`}>
<Suspense fallback={<div>Loading...</div>}>
<CrowdSorcerer
assignmentId={assignmentId}
exercises={exercises}
review={review}
/>
</Suspense>
</div>
)
}
}
export default withSimpleErrorBoundary(CrowdSorcererWrapper)