![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@avinlab/react-form
Advanced tools
A React library for building forms with ease, providing hooks for managing form state and validation in React applications.
A React library for building forms with ease, providing hooks for managing form state and validation in React applications.
npm install @avinlab/react-form
Online example is here
Create form with validation:
import React from 'react';
import { useForm, useFormValidation, useFormWatch } from '@avinlab/react-form';
const ExampleForm = () => {
const form = useForm({ name: 'Bob', age: 20 });
const { errors, isValid, validate } = useFormValidation(form, (values, prevValues) => {
const errors = {};
if (!values.name) {
errors.name = 'Name is required';
}
if (values.age && values.age < 18) {
errors.age = 'Must be at least 18';
}
return errors;
});
const handleSubmit = (e) => {
e.preventDefault();
if (isValid) {
console.log(form.values);
}
};
// If you want to render the form values:
// const nameValue = useFormWatch(form, 'name');
// const formValuesObj = useFormWatch(form);
return (
<form onSubmit={handleSubmit}>
<input
name="name"
defaultValue={form.values.name}
onChange={(e) => form.setValue('name', e.currentTarget.value)}
/>
{errors.name && <span className="error">{errors.name}</span>}
<input
name="age"
defaultValue={form.values.age}
onChange={(e) => form.setValue('name', e.currentTarget.value)}
/>
{errors.name && <span className="error">{errors.name}</span>}
<button type="submit" disabled={!isValid}>
Submit
</button>
</form>
);
};
For more advanced examples, check out the example directory.
FAQs
A React library for building forms with ease, providing hooks for managing form state and validation in React applications.
The npm package @avinlab/react-form receives a total of 1 weekly downloads. As such, @avinlab/react-form popularity was classified as not popular.
We found that @avinlab/react-form demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.