+
-
-
- {/*
*/}
- {/*
- 이름(Name)
-
-
-
- 비밀번호(Password)
-
-
-
-
-
*/}
-
- {/* localStorage를 사용해야는지 localstorage를 사용해야하는지 */}
- {/*
*/}
-
-
- {/*
*/}
>
)
diff --git a/src/Quiz.js b/src/Quiz.js
index e069e6db251b9b50cfae0df56ab162844abcc47f..603479dc720aa5425fc0013965da45e5d69b84e9 100644
--- a/src/Quiz.js
+++ b/src/Quiz.js
@@ -1,5 +1,5 @@
import React, { useState } from 'react'
-import { Link } from 'react-router-dom';
+import { Link, Redirect } from 'react-router-dom';
import Timer from 'react-compound-timer'; // 타이머쓰기위해 import
import logo from './img_question.png'
@@ -11,7 +11,8 @@ const QnA = [
{ Q: "3 - 1 = ?", Choose: [1, 2, 3, 4], A: "2", N: 3 }
]
-let Answers = []
+let Answers = [0,0,0]
+localStorage.setItem('Answers', JSON.stringify(Answers))
let Solutions = [4, 3, 2]
localStorage.setItem('Solutions', JSON.stringify(Solutions))
@@ -24,6 +25,8 @@ function Quiz() {
const [selected, setSelected] = useState("") //선택한 답을 보여줄 것들
// const [checked, setChecked] = useState(false)
+ const [timeout, settimeout] = useState(false)
+
function handleQuestion() {
setQuestion({ ...QnA[question.i + 1], i: question.i + 1, page: question.page + 1 })
// setChecked(false)
@@ -35,9 +38,10 @@ function Quiz() {
Answers[question.N - 1] = Number(ev.target.id) + 1
localStorage.setItem('Answers', JSON.stringify(Answers))
- }
+ }
return (
-
+ <>
+
미적분학 퀴즈
@@ -53,30 +57,32 @@ function Quiz() {
Your Answer :
{selected} {/* 선택한 값 보여줌 */}
{(question.page === QnA.length - 1)
?
-
+
:
}
alert('시간이 초과되었습니다.'),
+ },
{
time: 0,
- callback: 제출
- // history.go(1)
+ callback: () => settimeout(true),
+
}
]}
>
@@ -92,6 +98,8 @@ function Quiz() {
+ {timeout ?
: '' }
+ >
)
diff --git a/src/index.js b/src/index.js
index e10a9d0c9df3c0824decb34ebe6f126b1779f6aa..c39d898eeed3c29fcaa29b9b7feb7f8b1a344423 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,5 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
+import 'react-dom'
import './index.css';
import App from './App';
// import Quiz from './Quiz';
diff --git a/src/index2.js b/src/index2.js
new file mode 100644
index 0000000000000000000000000000000000000000..d789e1ff3d31706f80a0a21d9ce9bd66e98017f7
--- /dev/null
+++ b/src/index2.js
@@ -0,0 +1,27 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import 'react-dom'
+import './index.css';
+
+import Home from './Home'
+import Quiz from './Quiz'
+import End from './End'
+
+import { BrowserRouter as Router, Route } from 'react-router-dom';
+// import Quiz from './Quiz';
+import * as serviceWorker from './serviceWorker';
+import 'bootstrap/dist/css/bootstrap.css'
+
+ReactDOM.render(
+
+
+
+
+ ,
+ document.getElementById('root')
+);
+
+// If you want your app to work offline and load faster, you can change
+// unregister() to register() below. Note this comes with some pitfalls.
+// Learn more about service workers: https://bit.ly/CRA-PWA
+serviceWorker.unregister();