The thing is that I have this select element with some options:
{result.map(({ question }) => ( <option key={question.id} value={question.id} data-type={question.type} data-question={question}> {question.title} </option> ))}
If I get the data set question, I get this:
console.log({ questionItSelf: JSON.stringify(getSelectedOption.dataset.question) }) // {questionItSelf: "\"[object Object]\""}
How can I get those values to use them in another place?
https://stackoverflow.com/questions/67327311/how-to-pass-an-object-to-a-select-element-as-a-data-type-and-make-it-readable-to April 30, 2021 at 10:08AM
没有评论:
发表评论