Here's my code:
function Component(props) {
const [message, setMessage] = useState({
type: "",
text: "",
});
return (
<div>
<select
onChange={(ev) => {
setMessage({ type: **CAN SOMETHING GO HERE???**, text: ev.target.value });
}}
required
>
<option value="Ask a question" **DIFFERENT ATTRIBUTE TO SET TYPE WITH???**>Question</option>
<option value="Leave a comment">Comment</option>
<option value="Voice a concern">Concern</option>
</select>
</div>
);
}
export default Component;
Is it possible to somehow have another value or something similar in my options
so that I can set both the type and text from the same onChange
function? I'm not sure how else to do it and I need both a type and a text for a message to work.