Forceupdate things
This commit is contained in:
parent
d162a4005d
commit
c5788a00d2
1 changed files with 14 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import "../../App.css";
|
import "../../App.css";
|
||||||
import Footer from "../../Footer";
|
import Footer from "../../Footer";
|
||||||
import InputField from "../InputField";
|
import InputField from "../InputField";
|
||||||
|
@ -8,6 +8,12 @@ import BehaviorStudyInfo from "../BehaviorStudyInfo";
|
||||||
import BehaviorNormal from "../BehaviorNormal";
|
import BehaviorNormal from "../BehaviorNormal";
|
||||||
import { Button } from "../Button";
|
import { Button } from "../Button";
|
||||||
|
|
||||||
|
//create your forceUpdate hook
|
||||||
|
function useForceUpdate() {
|
||||||
|
const [value, setValue] = useState(0)
|
||||||
|
return () => setValue(value => value +1)
|
||||||
|
}
|
||||||
|
|
||||||
export default function Study() {
|
export default function Study() {
|
||||||
let username = "";
|
let username = "";
|
||||||
const setUsername = (tmp_username) => {
|
const setUsername = (tmp_username) => {
|
||||||
|
@ -29,6 +35,8 @@ export default function Study() {
|
||||||
isStepNormal = tmp;
|
isStepNormal = tmp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const forceUpdate = useForceUpdate();
|
||||||
|
|
||||||
let logger = new Logger({
|
let logger = new Logger({
|
||||||
//inputs: ["cursor", "wheel", "keyboard", "touch"],
|
//inputs: ["cursor", "wheel", "keyboard", "touch"],
|
||||||
inputs: ["keyboard"],
|
inputs: ["keyboard"],
|
||||||
|
@ -64,11 +72,13 @@ export default function Study() {
|
||||||
|
|
||||||
const handleIsStepStart = () => {
|
const handleIsStepStart = () => {
|
||||||
setIsStepStart(false);
|
setIsStepStart(false);
|
||||||
console.log("isStepStar", isStepStart)
|
console.log("isStepStar", isStepStart);
|
||||||
setIsStepNormal(true);
|
setIsStepNormal(true);
|
||||||
console.log("isStepStar", isStepNormal)
|
console.log("isStepNormal", isStepNormal);
|
||||||
|
forceUpdate();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const onSubmitClick = (e) => {
|
const onSubmitClick = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let opts = {
|
let opts = {
|
||||||
|
@ -152,6 +162,7 @@ export default function Study() {
|
||||||
</form>
|
</form>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
|
<button onClick={handleLoggerOff}>LOGGER STOPPEN</button>
|
||||||
</div>
|
</div>
|
||||||
<Footer />
|
<Footer />
|
||||||
</>
|
</>
|
||||||
|
|
Loading…
Reference in a new issue