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
6594e718
Commit
6594e718
authored
Jul 26, 2020
by
Jiwon Yoon
Browse files
quiz
parent
26eec347
Changes
3
Show whitespace changes
Inline
Side-by-side
src/App.js
View file @
6594e718
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
logo
from
'
./logo.svg
'
;
//
import logo from './logo.svg';
import
'
./App.css
'
;
import
'
./App.css
'
;
function
App
()
{
function
App
()
{
...
@@ -11,4 +11,5 @@ function App() {
...
@@ -11,4 +11,5 @@ function App() {
);
);
}
}
export
default
App
;
export
default
App
;
src/Quiz.js
0 → 100644
View file @
6594e718
import
React
from
'
react
'
;
// import logo from './logo.svg';
// import './App.css';
const
question
=
[
{
Q
:
"
당신의 성별은?
"
,
A
:
""
},
{
Q
:
"
당신의 이름은?
"
,
A
:
""
},
{
Q
:
"
당신의 점수는?
"
,
A
:
""
}
]
class
Quiz
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
)
this
.
setAnswer
=
this
.
setAnswer
.
bind
(
this
)
this
.
setQuestion
=
this
.
setQuestion
.
bind
(
this
)
this
.
state
=
{...
question
[
0
],
i
:
0
,
v
:
""
}
}
setQuestion
()
{
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
})
console
.
log
(
this
.
state
)
console
.
log
(
question
)
}
render
()
{
return
(
<
div
>
<
h2
>
Q
:{
this
.
state
.
Q
}
<
/h2
>
<
div
>
<
input
type
=
"
text
"
value
=
{
this
.
state
.
v
}
name
=
"
A
"
onChange
=
{
this
.
setAnswer
}
/
>
<
/div
>
<
button
type
=
"
button
"
onClick
=
{
this
.
setQuestion
}
>
다음
문제로
<
/button
>
<
/div
>
)
}
}
export
default
Quiz
;
src/index.js
View file @
6594e718
...
@@ -2,11 +2,12 @@ import React from 'react';
...
@@ -2,11 +2,12 @@ import React from 'react';
import
ReactDOM
from
'
react-dom
'
;
import
ReactDOM
from
'
react-dom
'
;
import
'
./index.css
'
;
import
'
./index.css
'
;
import
App
from
'
./App
'
;
import
App
from
'
./App
'
;
import
Quiz
from
'
./Quiz
'
;
import
*
as
serviceWorker
from
'
./serviceWorker
'
;
import
*
as
serviceWorker
from
'
./serviceWorker
'
;
ReactDOM
.
render
(
ReactDOM
.
render
(
<
React
.
StrictMode
>
<
React
.
StrictMode
>
<
App
/>
<
Quiz
/>
<
/React.StrictMode>
,
<
/React.StrictMode>
,
document
.
getElementById
(
'
root
'
)
document
.
getElementById
(
'
root
'
)
);
);
...
...
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