I have a table of text boxes and want a given text box to highlight when I change it. I have the CSS class but am not able to apply it to a specific field.
Here is one of the fields.
{cookies.map(cookie =>
<tr key={cookie.id}>
...
<td><input
name="desc"
value={cookie.desc}
type="text"
onChange={(e) => onChangeInput(e, cookie.id)}
placeholder="Type Desc"
className={changed}/></td>
</tr>
)}
Here is the event handler. It currently changes the entire column. I have access to both the ID and the name of the field inside the handler so how would I use them to narrow my class change?
const [changed, setChanged] = useState('');
const onChangeInput = (e, id) => {
const { name, value } = e.target
setChanged('highlighted-input')
...
}