aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Question.tsx
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2022-06-18 23:59:14 +0400
committerGravatar Hassan Abouelela <[email protected]>2022-06-18 23:59:14 +0400
commit5f4ddc8fd7d84500457bb08b0981a84a2d1594b1 (patch)
treedd6d0323f69451de19a2e500fdd8814b473d0669 /src/components/Question.tsx
parentBump CodeMirror to 6.0.0 (diff)
Bump React To 18.2.0
Bump react to v18, and handle all the breaking changes. This includes bumping a lot of other dependencies to versions which support react 18, and handling the breaking changes for those. Refer to the following documents for migration guides: React: https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html Router: https://reactrouter.com/docs/en/v6/upgrading/v5 Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'src/components/Question.tsx')
-rw-r--r--src/components/Question.tsx16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/components/Question.tsx b/src/components/Question.tsx
index ebacb4a..61e66e0 100644
--- a/src/components/Question.tsx
+++ b/src/components/Question.tsx
@@ -35,14 +35,22 @@ class RenderedQuestion extends React.Component<QuestionProp> {
}
this.blurHandler = this.blurHandler.bind(this);
- this.setPublicState("valid", true);
- this.setPublicState("error", "");
+ const _state: {[key: string]: string | boolean | null} = {
+ "valid": true,
+ "error": "",
+ };
+
if (props.question.type === QuestionType.Code) {
- this.setPublicState("unittestsFailed", false);
+ _state["unittestsFailed"] = false;
}
if (!skip_normal_state.includes(props.question.type)) {
- this.setPublicState("value", "");
+ _state["value"] = "";
+ }
+
+ this.state = _state;
+ for (const [key, value] of Object.entries(_state)) {
+ this.props.public_state.set(key, value);
}
}