https://github.com/danielkov/use-formspree
React hook to simplify creating forms with FormSpree.
https://github.com/danielkov/use-formspree
Last synced: about 1 year ago
JSON representation
React hook to simplify creating forms with FormSpree.
- Host: GitHub
- URL: https://github.com/danielkov/use-formspree
- Owner: danielkov
- License: mit
- Created: 2021-01-30T00:24:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-04-02T08:13:41.000Z (about 1 year ago)
- Last Synced: 2025-04-08T22:02:03.102Z (about 1 year ago)
- Language: TypeScript
- Size: 31.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# use-formspree
React hook to simplify creating forms with [FormSpree](https://formspree.io/).
## Getting Started
Install with:
```sh
yarn add use-formspree # or npm install use-formspree
```
## Usage
Inside your components
```tsx
import useFormSpree from "use-formspree";
const url = "https://formspree.io/f/";
const Form = () => {
const [{ error, loading, response }, bind] = useFormSpree(url, {
// reset the form after submit
reset: true,
});
if (response) {
return
Thank you for submitting.
;
}
return (
Name:
E-mail:
Send
{error &&
Woops. {String(error)}
}
);
};
```