gitHub : https://github.com/leeyulgok/yulgok-page
const ContactForm = () => {
const [isValid, setIsValid] = useState({
name: null,
phone: null,
email: null,
message: null,
});
const isFormValid = Object.values(isValid).every((value) => value);
...
return (
...
<div className={classes.submitBtn}>
<Button
className={`${classes.contactBtn} ${
isFormValid ? classes.activeBtn : ""
}`}
type="submit"
disabled={!isFormValid}
>
Send
</Button>
</div>
...
);
};
export default ContactForm;