Home.js 1.09 KB
Newer Older
Jiwon Yoon's avatar
a    
Jiwon Yoon committed
1
2
3
import React from 'react'
import { Link } from 'react-router-dom';
import './Home.css';
4

Jiwon Yoon's avatar
Jiwon Yoon committed
5
6
7
8


function Home() {
    return (
9
        <div className="container">
Jiwon Yoon's avatar
a    
Jiwon Yoon committed
10
            <div >
11
                <div className="text-center">이름을 입력하세요</div>
Jiwon Yoon's avatar
home    
Jiwon Yoon committed
12
                <div>
Jiwon Yoon's avatar
a    
Jiwon Yoon committed
13
14
15
16
17
                    <div>
                        <input className="inputBox" onChange={(event) => sessionStorage.setItem('name', event.target.value)} />
                    </div>
                    <div>
                        <Link to="/quiz">
18
                            <button className="btn btn-dark" onClick={checking}>Quiz Start !</button>
Jiwon Yoon's avatar
a    
Jiwon Yoon committed
19
20
                        </Link>
                    </div>
Jiwon Yoon's avatar
home    
Jiwon Yoon committed
21
                </div>
Jiwon Yoon's avatar
Jiwon Yoon committed
22
            </div>
Jiwon Yoon's avatar
a    
Jiwon Yoon committed
23
24
25
26
27
            <div>
                계산수학
            </div>
        </div>

Jiwon Yoon's avatar
Jiwon Yoon committed
28
29
    )
}
Jiwon Yoon's avatar
a    
Jiwon Yoon committed
30
function checking() {
baesangjune's avatar
baesangjune committed
31

baesangjune's avatar
0805    
baesangjune committed
32
    if (localStorage.getItem('name') === null || localStorage.getItem('name').length === 0) {
Jiwon Yoon's avatar
a    
Jiwon Yoon committed
33
        alert('이름을 입력하세요')
baesangjune's avatar
baesangjune committed
34

Jiwon Yoon's avatar
a    
Jiwon Yoon committed
35
36
    }
    else {
baesangjune's avatar
0805    
baesangjune committed
37
        alert('입력하신 이름은' + localStorage.getItem('name') + '입니다.')
Jiwon Yoon's avatar
a    
Jiwon Yoon committed
38
39
    }
}
Jiwon Yoon's avatar
home    
Jiwon Yoon committed
40

41

Jiwon Yoon's avatar
a    
Jiwon Yoon committed
42
export default Home;