Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/formspark/use-formspark
React hooks for Formspark
https://github.com/formspark/use-formspark
form forms formspark hook jamstack react react-hooks static static-site
Last synced: 3 months ago
JSON representation
React hooks for Formspark
- Host: GitHub
- URL: https://github.com/formspark/use-formspark
- Owner: formspark
- License: mit
- Created: 2020-11-13T18:11:06.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-09-28T18:58:35.000Z (over 1 year ago)
- Last Synced: 2024-10-31T19:23:22.763Z (3 months ago)
- Topics: form, forms, formspark, hook, jamstack, react, react-hooks, static, static-site
- Language: TypeScript
- Homepage: https://formspark.io/for/react/
- Size: 537 KB
- Stars: 16
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
use-formspark
React hooks for Formspark.
Works with React and React Native.[![Continuous deployment](https://github.com/formspark/use-formspark/workflows/Continuous%20deployment/badge.svg)](https://github.com/formspark/use-formspark/actions?query=workflow%3A%22Continuous+deployment%22)
## Installation
```bash
# NPM
npm install @formspark/use-formspark# Yarn
yarn add @formspark/use-formspark
```## Usage
```tsx
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 (
{
e.preventDefault();
await submit({ message })
}}>
setMessage(e.target.value)}
/>
Send
);
};
```**Note:** do not mistake action url (e.g. `https://submit-form.com/capybara`) and form id (e.g. `capybara`), this package only uses the latter.
## License
[MIT](https://opensource.org/licenses/MIT)