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
e4916d4b
Commit
e4916d4b
authored
Jul 27, 2020
by
Jiwon Yoon
Browse files
화면전환
parent
6594e718
Changes
2
Show whitespace changes
Inline
Side-by-side
src/Quiz.js
View file @
e4916d4b
...
...
@@ -14,20 +14,33 @@ class Quiz extends React.Component {
super
(
props
)
this
.
setAnswer
=
this
.
setAnswer
.
bind
(
this
)
this
.
setQuestion
=
this
.
setQuestion
.
bind
(
this
)
this
.
state
=
{...
question
[
0
],
i
:
0
,
v
:
""
}
this
.
ShowQuiz1
=
this
.
ShowQuiz1
.
bind
(
this
)
this
.
state
=
{
...
question
[
0
],
i
:
0
,
v
:
""
,
r
:
0
}
}
ShowQuiz1
()
{
this
.
setState
({
r
:
1
})
}
setQuestion
()
{
this
.
setState
({...
question
[
this
.
state
.
i
+
1
],
i
:
this
.
state
.
i
+
1
,
v
:
""
})
this
.
setState
({
...
question
[
this
.
state
.
i
+
1
],
i
:
this
.
state
.
i
+
1
,
v
:
""
})
}
setAnswer
(
e
)
{
question
[
this
.
state
.
i
][
"
A
"
]
=
e
.
target
.
value
this
.
setState
({
v
:
e
.
target
.
value
})
this
.
setState
({
v
:
e
.
target
.
value
})
console
.
log
(
this
.
state
)
console
.
log
(
question
)
}
render
()
{
if
(
this
.
state
.
r
===
1
)
{
if
(
this
.
state
.
i
===
3
)
{
return
(
<
div
>
<
h2
>
수고하셨습니다
!<
/h2
>
<
/div
>
)
}
else
{
return
(
<
div
className
=
"
quiz
"
>
<
h2
>
Q
:{
this
.
state
.
Q
}
<
/h2
>
<
div
>
<
input
type
=
"
text
"
value
=
{
this
.
state
.
v
}
name
=
"
A
"
onChange
=
{
this
.
setAnswer
}
/
>
...
...
@@ -36,6 +49,23 @@ class Quiz extends React.Component {
<
/div
>
)
}
}
else
{
return
(
<>
<
div
className
=
"
App
"
>
<
h1
style
=
{{
background
:
"
orange
"
,
display
:
"
inline-block
"
,
border
:
"
3px solid black
"
,
width
:
"
200px
"
}}
>
Calculus
<
/h1
>
<
/div
>
<
div
className
=
"
App
"
>
이름을
입력하세요
<
input
onChange
=
{(
event
)
=>
{
console
.
log
(
event
.
target
.
value
)
}}
/
>
<
/div
>
<
button
onClick
=
{
this
.
ShowQuiz1
}
style
=
{{
margin
:
"
30px
"
,
marginLeft
:
"
690px
"
,
width
:
"
150px
"
,
height
:
"
30px
"
,
fontFamily
:
"
impact
"
}}
>
Quiz
Start
!<
/button
>
<
/
>
)
}
}
}
export
default
Quiz
;
src/index.js
View file @
e4916d4b
import
React
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
'
./index.css
'
;
import
App
from
'
./App
'
;
//
import App from './App';
import
Quiz
from
'
./Quiz
'
;
import
*
as
serviceWorker
from
'
./serviceWorker
'
;
...
...
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