
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
react-form-helper-validator
Advanced tools
ā” Tiny library for form state/ validation written entirely with React Hooks
ā” Tiny library for form state/ validation written entirely with React Hooks
npm install react-form-helper-validator --save
Or
yarn add react-form-helper-validator
First off let's import FormHelper
import FormHelper from "react-form-helper-validator";
and then wrap your form with FormHelper like so while providing required props
const model = {
email: "",
};
const rules = {
email: [
v => !v && "This field is required",
v => validationRules.emailValidation(v, "email")
]
};
<FormValidator model={model} rules={rules}>
{({
validate,
formData,
formState,
formErrors,
update,
resetForm,
hasErrors,
validateField,
clearValidation
}) => {
const handleSubmit = e => {
e.preventDefault();
validate()
.then(() => {
console.log("submitting", formData);
})
.catch(err => {
console.error("err", err);
});
};
return (
<form onSubmit={handleSubmit}>
<div className="field">
<label className="label">
Email
</label>
<div className="control">
<input
name="email"
value={formData.email}
onChange={update.text}
className="input"
type="email"
placeholder="Enter your email"
/>
</div>
<p
className={`help ${!formErrors["email"] &&
"is-success"} ${formErrors["email"] && "is-danger"}`}
>
{formErrors["email"]}
</p>
</div>
<button
onClick={handleSubmit}
type="submit"
className="button"
>
Submit
</button>
</form>
)
}
</FormValidator>
Prop | Required | Type | Purpose |
---|---|---|---|
model | true | Object | Provides initial form data |
rules | false | Object | An object containing an array of rules which corresponds to data properties. Rules are functions that return an error string on error and false otherwise |
manual | false | Array | An array of field names which shall not be validated automatically on change |
FAQs
ā” Tiny library for form state/ validation written entirely with React Hooks
The npm package react-form-helper-validator receives a total of 6 weekly downloads. As such, react-form-helper-validator popularity was classified as not popular.
We found that react-form-helper-validator 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
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.