How can I swap the word email here for value??
const [state, setState] = useState({
emailError: '',
});
const myFunction = (event: ChangeEvent<HTMLInputElement>) => {
const value = event.target.id; // 'email'
if (event.target.id === value && state.emailError) validate(value);
// ^
// |___ How can I swap the word email here for value??
}
I tried with this..
if (event.target.id === value && state[value]+Error) validate(value);