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
fa3d05da
Commit
fa3d05da
authored
Aug 09, 2020
by
Jiwon Yoon
Browse files
wlsWk
parent
8c2acaf7
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Quiz.js
View file @
fa3d05da
...
@@ -13,7 +13,6 @@ let Answers = []
...
@@ -13,7 +13,6 @@ let Answers = []
let
Solutions
=
[
4
,
3
,
2
]
let
Solutions
=
[
4
,
3
,
2
]
function
Quiz
()
{
function
Quiz
()
{
localStorage
.
setItem
(
'
Solutions
'
,
JSON
.
stringify
(
Solutions
))
const
[
question
,
setQuestion
]
=
useState
({
const
[
question
,
setQuestion
]
=
useState
({
...
QnA
[
0
],
...
QnA
[
0
],
...
@@ -32,6 +31,7 @@ function Quiz() {
...
@@ -32,6 +31,7 @@ function Quiz() {
setSelected
(
ev
.
target
.
value
)
//selected값 변경
setSelected
(
ev
.
target
.
value
)
//selected값 변경
Answers
[
question
.
N
-
1
]
=
Number
(
ev
.
target
.
id
)
+
1
Answers
[
question
.
N
-
1
]
=
Number
(
ev
.
target
.
id
)
+
1
localStorage
.
setItem
(
'
Answers
'
,
JSON
.
stringify
(
Answers
))
localStorage
.
setItem
(
'
Answers
'
,
JSON
.
stringify
(
Answers
))
console
.
log
(
Answers
)
}
}
return
(
return
(
...
@@ -61,7 +61,7 @@ function Quiz() {
...
@@ -61,7 +61,7 @@ function Quiz() {
<
span
className
=
"
h2 font-weight-bold text-danger
"
>
{
selected
}
<
/span> {/
*
선택한
값
보여줌
*
/
}
<
span
className
=
"
h2 font-weight-bold text-danger
"
>
{
selected
}
<
/span> {/
*
선택한
값
보여줌
*
/
}
<
div
className
=
"
text-center my-3
"
>
{(
question
.
page
===
QnA
.
length
-
1
)
<
div
className
=
"
text-center my-3
"
>
{(
question
.
page
===
QnA
.
length
-
1
)
?
<
Link
to
=
"
/end
"
>
?
<
Link
to
=
"
/end
"
>
<
button
className
=
"
btn btn-outline-success
"
>
제출
<
/button
>
<
button
className
=
"
btn btn-outline-success
"
onClick
=
{
localStorage
.
setItem
(
'
Solutions
'
,
JSON
.
stringify
(
Solutions
))}
>
제출
<
/button
>
<
/Link
>
<
/Link
>
:
<
button
type
=
"
button
"
className
=
"
btn btn-outline-dark
"
onClick
=
{
handleQuestion
}
>
다음
<
/button
>
:
<
button
type
=
"
button
"
className
=
"
btn btn-outline-dark
"
onClick
=
{
handleQuestion
}
>
다음
<
/button
>
}
}
...
...
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