import React from 'react'; // import logo from './logo.svg'; import './Quiz.css'; import 'bootstrap/dist/css/bootstrap.css'; const question = [ { Q: "6 X 4 ?", Choose: [6, 12, 18, 24]}, { Q: "3 + 3 ?", Choose: [2, 4, 6, 8]}, { Q: "3 - 1 ?", Choose: [1, 2, 3, 4]} ] class Quiz extends React.Component { constructor(props) { super(props) // this.setAnswer = this.setAnswer.bind(this) this.checking=this.checking.bind(this) this.setQuestion = this.setQuestion.bind(this) this.ShowQuiz = this.ShowQuiz.bind(this) this.state = { ...question[0], i: 0, page: 0 } } ShowQuiz() { this.setState({ page: 1 }) } setQuestion() { this.setState({ ...question[this.state.i + 1], i: this.state.i + 1 }) } // setAnswer(e) { // question[this.state.i]["A"] = e.target.value // this.setState({ v: e.target.value }) // console.log(this.state) // console.log(question) // } checking(e){ this.setState({ userAnswer: e.target.value }) console.log(this.state) console.log(question) } render() { if (this.state.page === 1) { if (this.state.i === question.length) { return (