Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
online-quiz-react
Commits
109ab3ca
Commit
109ab3ca
authored
Aug 10, 2020
by
Jiwon Yoon
Browse files
a
parent
ab596d53
Changes
1
Show whitespace changes
Inline
Side-by-side
src/Quiz.js
View file @
109ab3ca
...
...
@@ -12,9 +12,9 @@ const QnA = [
let
Answers
=
[
0
,
0
,
0
]
localStorage
.
setItem
(
'
Answers
'
,
JSON
.
stringify
(
Answers
))
let
Solutions
=
[
4
,
3
,
2
]
localStorage
.
setItem
(
'
Solutions
'
,
JSON
.
stringify
(
Solutions
))
function
Quiz
()
{
const
[
question
,
setQuestion
]
=
useState
({
...
QnA
[
0
],
i
:
0
,
...
...
@@ -26,11 +26,10 @@ function Quiz() {
function
handleQuestion
()
{
setQuestion
({
...
QnA
[
question
.
i
+
1
],
i
:
question
.
i
+
1
,
page
:
question
.
page
+
1
})
setSelected
(
""
)
//페이지 넘어가면
Your Answer
초기화
setSelected
(
""
)
//페이지 넘어가면
selected
초기화
}
let
handleChange
=
(
ev
)
=>
{
// ev.preventDefault() //새로고침 안되도록
setSelected
(
ev
.
target
.
value
)
//selected값 변경
Answers
[
question
.
N
-
1
]
=
Number
(
ev
.
target
.
id
)
+
1
localStorage
.
setItem
(
'
Answers
'
,
JSON
.
stringify
(
Answers
))
...
...
@@ -69,7 +68,7 @@ function Quiz() {
<
/div
>
<
p
className
=
"
h3 text-center text-danger
"
>
<
Timer
initialTime
=
{
3
6
000
}
initialTime
=
{
300
1
0
}
direction
=
"
backward
"
checkpoints
=
{[
{
time
:
1
,
...
...
@@ -84,7 +83,7 @@ function Quiz() {
>
{()
=>
(
<>
<
Timer
.
Minutes
/>
:
<
Timer
.
Seconds
><
/Timer.Seconds> /
6
0
:
00
<
/
>
<
Timer
.
Minutes
/>
:
<
Timer
.
Seconds
><
/Timer.Seconds> /
3
0
:
00
<
/
>
)}
<
/Timer> {/
*
npm
i
react
-
compound
-
timer
*
/
}
<
/p
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment