import React, { useState } from 'react'; let list = [] let QnAadmins = [] let QnAadmin = {} function AdminQuiz() { const [question, setQuestion] = useState('') const [choose, setChoose] = useState('') const [answer, setAnswer] = useState('') const [selectOption, setselectOption] = useState(1) const handleChangeQuestion = (event) => { QnAadmin['Q'] = event.target.value setQuestion(event.target.value) } const handleChangeChoose = (event) => { QnAadmin['Choose'] = event.target.value setChoose(event.target.value) } const handleChangeanswer = (event) => { QnAadmin['A'] = event.target.value setAnswer(event.target.value) } function addSelectOption() { list.push(
) setselectOption(selectOption + 1) } function handleClick() { if (!question) { alert('문제가 입력되지 않았습니다.') } else if (!choose) { alert('보기가 입력되지 않았습니다.') } else if (!answer) { alert('정답이 입력되지 않았습니다.') } else { console.log(QnAadmin) QnAadmins.push(QnAadmin) localStorage.setItem('QnA', JSON.stringify(QnAadmins)) console.log(QnAadmins) alert('입력이 완료되었습니다.') } } // function handleChangeQuestion(){} return (

문제만들기

1.
{list.map((element) => element)}
정답:
) } export default AdminQuiz