import React from 'react'; // import logo from './logo.svg'; import './Quiz.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.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: "" }) } setAnswer(e) { question[this.state.i]["A"] = 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 (

수고하셨습니다!

) } else { return (

Q:{this.state.Q}

) } } else { return (

Calculus

이름을 입력하세요 { console.log(event.target.value) }} />
) } } } export default Quiz;