import React from 'react'
import { Link } from 'react-router-dom';
import './Home.css';



function Home() {
    return (
        <div className="container">
            <div >
                <div className="text-center">이름을 입력하세요</div>
                <div>
                    <div>
                        <input className="inputBox" onChange={(event) => sessionStorage.setItem('name', event.target.value)} />
                    </div>
                    <div>
                        <Link to="/quiz">
                            <button className="btn btn-dark" onClick={checking}>Quiz Start !</button>
                        </Link>
                    </div>
                </div>
            </div>
            <div>
                계산수학
            </div>
        </div>

    )
}
function checking() {

    if (localStorage.getItem('name') === null || localStorage.getItem('name').length === 0) {
        alert('이름을 입력하세요')

    }
    else {
        alert('입력하신 이름은' + localStorage.getItem('name') + '입니다.')
    }
}


export default Home;
