An open API service indexing awesome lists of open source software.

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.

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)}

}

);
};
```