Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@formcarry/react
Advanced tools
Readme
React library of formcarry.
Run this command to install with yarn:
yarn add @formcarry/react
or with npm:
npm install --save @formcarry/react
You have to have React as a dependency in your project in order to use this library.
Also this package uses React Hooks, therefore you have to use React >= 16.8.0
A simple demonstration with React library:
import { useForm } from '@formcarry/react';
function MyFormcarry() {
// Call the `useForm` hook in your function component
const {state, submit} = useForm({
id: 'Your-Form-ID-From-Formcarry'
});
// Success message
if (state.submitted) {
return <div>Thank you! We received your submission.</div>;
}
return (
<form onSubmit={submit}>
<label htmlFor="name">Name</label>
<input id="name" type="text" name="text" />
<label htmlFor="surname">Surname</label>
<input id="surname" type="text" name="surname" />
<label htmlFor="email">Email</label>
<input id="email" type="email" name="email" />
<label htmlFor="message">Message</label>
<textarea id="message" name="message" />
<button type="submit">Send</button>
</form>
);
}
You have to use a <form>
element and pass submit
as the onSubmit
handler.
We return state
and submit
from useForm
by default, but you can rename it to whatever you want, like this:
import { useForm } from '@formcarry/react';
function MyFormcarry() {
const {state: formcarryState, submit: formcarrySubmit} = useForm({
id: 'Your-Form-ID-From-Formcarry'
});
if (formcarryState.submitted) {
return <div>Thank you! We received your submission.</div>;
}
return (
<form onSubmit={formcarrySubmit}>
<label htmlFor="name">Name</label>
<input id="name" type="text" name="text" />
<label htmlFor="surname">Surname</label>
<input id="surname" type="text" name="surname" />
<label htmlFor="email">Email</label>
<input id="email" type="email" name="email" />
<label htmlFor="message">Message</label>
<textarea id="message" name="message" />
<button type="submit">Send</button>
</form>
);
}
import { useForm } from '@formcarry/react';
function MyFormcarry() {
// Call the `useForm` hook in your function component
const {state, submit} = useForm({
id: 'Your-Form-ID-From-Formcarry',
extraData: {
// add whatever you want
screenSize: `${window.screen.width}x${window.screen.height}`,
language: window.navigator.language,
}
});
...
}
You can pass those to useForm
:
Key | Description |
---|---|
id | Your Form ID, which you can get it from formcarry |
debug | Boolean, it prints out logs to the console, true by default |
extraData | Accepts object, it will mix those object with form fields |
The state
object contains the following:
Key | Description |
---|---|
submitting | A Boolean indicating whether the form is currently submitting |
submitted | A Boolean indicating whether the form successfully submitted |
response | Returns formcarry successful response |
error | Returns formcarry error |
FAQs
React Hooks library for Formcarry | formcarry.com
The npm package @formcarry/react receives a total of 224 weekly downloads. As such, @formcarry/react popularity was classified as not popular.
We found that @formcarry/react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.