mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
Use tRPC for contact form
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
import { ChangeEvent, useState } from "react";
|
||||
|
||||
const useContactForm = () => {
|
||||
const [values, setValues] = useState({
|
||||
email: "",
|
||||
subject: "",
|
||||
message: "",
|
||||
});
|
||||
|
||||
const handleChange = (
|
||||
e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,
|
||||
) => {
|
||||
setValues((prevState) => {
|
||||
return {
|
||||
...prevState,
|
||||
[e.target.id]: e.target.value,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const resetForm = () => {
|
||||
setValues({ email: "", subject: "", message: "" });
|
||||
};
|
||||
|
||||
return { values, handleChange, resetForm };
|
||||
};
|
||||
|
||||
export default useContactForm;
|
||||
Reference in New Issue
Block a user