---
# System prepended metadata

title: Upgrade from previous versions
tags: [zeta-dom-react]

---

---
tags: zeta-dom-react
---

# Upgrade from previous versions

## `useFormField(string, ...)`

| Deprecated | Removed |
| ---------- | ------- |
| v0.3.5     | -       |

For better tree-shaking of unused code, the field type argument now requires a constructor function.

For built-in field type, use the corresponding field type constructor:

```typescript
// ---------- old ----------
import { useFormField } from 'zeta-dom-react';
useFormField('text', { /* ... */ });
useFormField('toggle', { /* ... */ });
useFormField('choice', { /* ... */ });

// ---------- new ----------
import { useFormField, TextField, ToggleField, ChoiceField } from 'zeta-dom-react';
useFormField(TextField, { /* ... */ });
useFormField(ToggleField, { /* ... */ });
useFormField(ChoiceField, { /* ... */ });
```

To add custom field type, create a constructor function or a class implementing `FieldType` interface:

```typescript
// ---------- old ----------
import { registerFieldType } from 'zeta-dom-react';
registerFieldType('custom', { /* ... */ });
// use
useFormField('custom', { /* ... */});

// ---------- new ----------
class CustomField implements FieldType<CustomFieldProps, CustomFieldState> {
    valueProperty?: string | undefined;
    isEmpty(value: any): boolean {
        /* ... */
    }
    postHook(state: FormFieldState<any>, props: CustomFieldProps): CustomState {
        /* ... */
    }
}
// use
useFormField(CustomField, { /* ... */});
```

## `useErrorHandlerRef`

| Deprecated | Removed |
| ---------- | ------- |
| v0.3.2     | -       |

Equivalent to 

```typescript
useErrorHandler(source).ref
```