You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@formspark/use-formspark

Package Overview
Dependencies
Maintainers
0
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formspark/use-formspark

React hooks for Formspark

0.1.42
latest
Source
npm
Version published
Maintainers
0
Created
Source

Formspark logo

use-formspark

React hooks for Formspark.

Works with React and React Native.

Continuous deployment

Installation

# NPM
npm install @formspark/use-formspark

# Yarn 
yarn add @formspark/use-formspark

Usage

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

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

Keywords

formspark

FAQs

Package last updated on 10 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts