Skip to main content
Version: 0.1.2

Class: FieldNode

Imported from @react-logic/utils

Type Parameters​

T​

T = unknown

Constructors​

Constructor​

new FieldNode<T>(path, config): FieldNode<T>

Parameters​

path​

string[]

config​

FieldConfig<T>

Returns​

FieldNode<T>

Properties​

dirty​

readonly dirty: () => boolean

Dirty = value differs from initial.

Returns​

boolean


errors​

readonly errors: () => Record<string, string | null>

Per-validator-name error map.

Returns​

Record<string, string | null>


htmlAttrs​

readonly htmlAttrs: HTMLValidationAttrs


initial​

readonly initial: T


kind​

readonly kind: "text" | "checkbox" | "radio" | "select"


parse?​

readonly optional parse?: (raw) => T

Parameters​

raw​

string

Returns​

T


path​

readonly path: string


pathKey​

readonly pathKey: string


rawValue​

readonly rawValue: {(): string | boolean; (value): void; }

Underlying raw input (string for text/select/radio, boolean for checkbox).

Call Signature​

(): string | boolean

Returns​

string | boolean

Call Signature​

(value): void

Parameters​
value​

string | boolean

Returns​

void


touched​

readonly touched: {(): boolean; (value): void; }

Touched state — flips true on blur or on submit.

Call Signature​

(): boolean

Returns​

boolean

Call Signature​

(value): void

Parameters​
value​

boolean

Returns​

void


validators​

readonly validators: readonly ValidatorEntry<T>[]


value​

readonly value: () => T

Parsed/typed value — read this for values.

Returns​

T

Methods​

isValid()​

isValid(): boolean

Returns​

boolean


reset()​

reset(): void

Returns​

void