use formspark
1.0.0
Formspark용 React 후크.
React 및 React Native와 함께 작동합니다.
# NPM
npm install @formspark/use-formspark
# Yarn
yarn add @formspark/use-formspark
import React , { useState } from "react" ;
import { useFormspark } from "@formspark/use-formspark" ;
const ContactForm = ( ) => {
const [ submit , submitting ] = useFormspark ( {
formId : "your-form-id"
} ) ;
const [ message , setMessage ] = useState ( "" ) ;
return (
< form onSubmit = { async ( e ) => {
e . preventDefault ( ) ;
await submit ( { message } )
} } >
< textarea
value = { message }
onChange = { ( e ) => setMessage ( e . target . value ) }
/>
< button type = "submit" disabled = { submitting } > Send </ button >
</ form >
) ;
} ;
참고: 작업 URL(예: https://submit-form.com/capybara
)과 양식 ID(예: capybara
)를 혼동하지 마십시오. 이 패키지는 후자만 사용합니다.
MIT