Skip to content

Commit 4082315

Browse files
committed
Docs (architecture): Updates field declaration according to the latest API
1 parent aa49477 commit 4082315

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/architecture/field-lifecycle.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Developer must provide the custom event handlers during the field's declaration,
9393
```jsx
9494
// src/components/Input.jsx
9595
import React from 'react';
96-
import { createField } from 'react-advanced-form';
96+
import { createField, fieldPresets } from 'react-advanced-form';
9797

9898
class Input extends React.Component {
9999
/**
@@ -102,10 +102,10 @@ class Input extends React.Component {
102102
handleChange = (event) => {
103103
const { value: nextValue } = event.target;
104104

105-
// any additional logic here
105+
// ...
106106

107-
/* It is MANDATORY to dispatch the native RAF event handler */
108-
return this.props.handleFieldChange({ event });
107+
/* It is mandatory to dispatch the native RAF event handler */
108+
this.props.handleFieldChange({ event });
109109
}
110110

111111
render() {
@@ -119,7 +119,7 @@ class Input extends React.Component {
119119
}
120120
}
121121

122-
export default createField()(Input);
122+
export default createField(fieldPresets.input)(Input);
123123
```
124124

125125
When overriding the essential event handler managed by the `Form` automatically, the one must always dispatch the respective native event handler available via props:

0 commit comments

Comments
 (0)