import React, { useState, useEffect } from 'react'; let list = [] let QnAadmin = {} let savechoose = {} function AdminQuiz(props) { const [question, setQuestion] = useState(props.data.Q) const [choose, setChoose] = useState(props.data.Choose) const [answer, setAnswer] = useState(props.data.A) const [selectOption, setselectOption] = useState(1) // props.quizNum가 바뀔때마다 즉, Admin.js에서 퀴즈버튼을 바꿔누를때마다 useEffect가 발생하여 값을 업데이트 시켜줍니다. useEffect(() => { setQuestion(props.data.Q) setChoose(props.data.Choose) setAnswer(props.data.A) // eslint-disable-next-line }, [props.quizNum]) const handleChangeQuestion = (event) => { QnAadmin['Q'] = event.target.value setQuestion(event.target.value) } const handleChangeChoose = (event) => { savechoose[event.target.id] = event.target.value setChoose(event.target.value) console.log(event.target.value) } const handleChangeanswer = (event) => { QnAadmin['A'] = event.target.value setAnswer(event.target.value) } function addSelectOption() { list.push(