use formspark
1.0.0
Kait reaksi untuk Formspark.
Bekerja dengan React dan 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 >
) ;
} ;
Catatan: jangan salah mengira url tindakan (misalnya https://submit-form.com/capybara
) dan id formulir (misalnya capybara
), paket ini hanya menggunakan yang terakhir.
MIT