Validation·loomora → useStrict
useStrict
A declarative validation engine supporting numbers, strings, booleans, enums, files, objects, and arrays. Evaluates required rules, type bounds, and custom regex validation with live error messages.
Interactive live playground
Interact with the hook state and inspect computed return values in real time.
Validation StatusVALID
Result details
All field types and rules pass.
Validation Inputs
Email field"developer@loomora.dev"
Age field25
How to call
Import directly from the Loomora root package in any React client component.
import { useStrict } from 'loomora'
export function FormValidator() {
const { check } = useStrict()
const result = check({
email: { type: 'string', value: 'user@example.com', required: true },
age: { type: 'number', value: 25, required: true },
})
return (
<div>
<p>Is Valid: {result.isValid ? 'Yes' : 'No'}</p>
<p>Errors: {result.errors.join(', ')}</p>
</div>
)
}Return values & methods
API signatures and utilities returned by this hook.
| Method / Prop | Type | Description |
|---|---|---|
| check(schema) | (rules: UseStrictRules) => { isValid: boolean; isRequiredValid: boolean; variables: any; errors: string[] } | Evaluates rules against values and returns structured validity report. |