![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.
@casthub/form
Advanced tools
@casthub/form
provides Vue 3 Hooks for consuming, validating and managing Forms.
Inspired by vue-hooks-form.
This package is available via NPM:
yarn add @casthub/form
# or
npm install @casthub/form
A full example App is provided in the example folder.
<template>
<form @submit.prevent="submit">
<label for="email">Email Address</label>
<input
type="email"
name="email"
id="email"
placeholder="Email Address"
:disabled="loading"
@focus="email.clearError"
v-model="email.value"
/>
<p class="err" v-if="email.error">{{ email.error.message }}</p>
<label for="email">Password</label>
<input
type="password"
name="password"
id="password"
placeholder="Password"
:disabled="loading"
@focus="password.clearError"
v-model="password.value"
/>
<p class="err" v-if="password.error">{{ password.error.message }}</p>
<button
type="submit"
:disabled="loading"
>Login</button>
</form>
</template>
<script lang="ts" setup>
import { useForm } from '@casthub/form';
const { useField, handle, loading } = useForm<{
email: string;
password: string;
}>({
defaults: {
email: 'hello@example.com',
},
});
const email = useField('email', {
type: 'email',
required: true,
});
const password = useField('password', {
required: true,
});
const submit = handle(async ({ email, password }) => {
alert(`Email: ${email} Password: ${password}`);
});
</script>
useForm
Option | Default | Type | Description |
---|---|---|---|
defaults | {} | Record<string, any> | Optionally provide defaults for the various fields in this object by key -> value pairs. |
validationMode | submit | 'change'|'submit' | NOT IMPLEMENTED YET. Whether to validate input once submitted |
Option | Type | Description |
---|---|---|
useField | Field<unknown> | Documented below. |
handle | (run: values => Promise<void>) => async (e?: Event) => Promise<void> | Registers the asynchronous handler that runs once a form is submitted and successfully validated. |
reset | () => void | Reset the Form to tis default state. |
validate | () => Promise<boolean> | Manually trigger validation and error handling. |
clearErrors | () => void | Clear all errors for all fields. |
loading | Ref<boolean> | Whether the form is currently executing. |
destroy | () => void | Destroy and clean-up the Form handler. Happens automatically during onBeforeUnmount . |
useField
Currently the options object provided to useField
is inheritted from async-validator and all options are forwarded as a validation field.
Option | Type | Description |
---|---|---|
errors | ValidateError[] | An array of all Errors set against this Field. |
error | ValidateError|null | Optimistically picks one, if any, of the Errors against the field. |
hasError | ComputedRef<boolean> | Whether or not the Field has 1 or more errors. |
setError | (text: string) => void | Manually set the error on this field. |
clearError | () => void | Clears all Errors currently set against this Field. |
value | WritableComputedRef<unknown|string> | The value for the field, compatible with v-model . |
FAQs
Vue 3 Utility Hook for Form handling and validation
The npm package @casthub/form receives a total of 0 weekly downloads. As such, @casthub/form popularity was classified as not popular.
We found that @casthub/form 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.