RHFのForm
いつの間にか生えてたmrsekut.icon
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
/>
こんな感じで使える
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)}
/>