RHFのForm
https://react-hook-form.com/api/useform/form
いつの間にか生えてたmrsekut.icon
https://github.com/react-hook-form/react-hook-form/pull/9735
code:tsx
<Form
action="/api"
method="post" // default to post
onSubmit={() => {}} // function to be called before the request
onSuccess={() => {}} // valid response
onError={() => {}} // error response
validateStatus={status => status >= 200} // validate status code
/>
<form>の代わりに使う感じ
こんな感じで使える
code:tsx
// axios
<Form
action="/api"
method="post"
fetcher={(action, { values }) => axios(action, values)}
/>
// SWR, Tan Query
<Form
action="/api"
method="post"
fetcher={(action, { values }) => mutation(action)}
/>
https://tech.buysell-technologies.com/entry/2023/04/19/120000