← React Intermediate Questions - Set 5 Q46
React Intermediate Questions - Set 5
1 2 3
const errors = {}; if (!/^\S+@\S+$/.test(email)) errors.email = 'Invalid email'; <button disabled={Object.keys(errors).length > 0}>Send</button>