![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
adria-forms
Advanced tools
A super simple form validation and parsing library written in TypeScript. Works both in the client and server.
npm i adria-forms
yarn add adria-forms
pnpm add adria-forms
Demo: https://adria-demo.vercel.app
import { Form } from "adria-forms";
const form = new Form().field("username", (value) => {
if (!value) throw "Please enter your username";
if (typeof value !== "string") throw "Invalid input";
if (value.length < 4) throw "Username must be at least 4 characters long";
return value;
});
const formData = new FormData(); // can be a regular object as well
const { data, errors } = await form.parse(formData);
// intellisense
const usernameError = errors?.username;
const { username } = data;
Form
field()
Creates a new field. fieldName
cannot be an existing field name, and parse
can be a synchronous or asynchronous function. The return value will be mapped to data[fieldName]
of the return type of parse()
.
const field: (
fieldName: string,
parse: (
value: null | FormDataEntryValue,
formData: Map<string, FormDataEntryValue | null>
) => MaybePromise<any>
) => Form;
new Form()
.field("username", (value) => {
if (!value)
throw {
code: 0,
message: "empty input",
};
return value; // success
})
.field("password", (_, formData) => {
const usernameField = formData.get("username"); // autocompletes username, password
const passwordField = formData.get("randomFieldName"); // TS will yell at you since the field doesn't exist yet
})
.field(
"username" // TS will yell at you since this field already exists
// ...
);
parse()
Validates and parses the form data. Will only check fields defined with .field()
. Either errors
or data
will be null
, but not both.
const parse: (formData: FormData | Record<any, any>) => Promise<{
errors: Record<string, any> | null; // <fieldName, error>
data: Record<string, any> | null; // <fieldName, parseResult>
}>;
const form = new Form()
.field("username", (val) => {
return val;
})
.field("password", (val) => {
if (invalid) throw Error;
return val;
});
const { errors, data } = await form.parse(formData);
if (errors) {
const usernameError: undefined | unknown = errors.username;
const passwordError: undefined | unknown = errors.password;
} else {
const { username, password } = data;
}
FAQs
A super simple form validation library
We found that adria-forms 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
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.