0

I want to set the ID through the name, but instead it takes the name when i select, not the ID, this has worked for me in Angular with ngValue, but in react i cant seem to do it

<select className="form-select"
        value={authorId}
        onChange={(e) => setAuthorId(e.target.value)}>
    {authors.map(author => <option key={author.id} id={author.id}>
        {author.name}
    </option>)}
</select>

0 Answers0