Skip to content

Commit deea284

Browse files
sloriajquense
authored andcommitted
docs: don't shadow variable and exemplify arrayHelpers.add (#162)
`.add` is more intuitive in the UI example and probably more common.
1 parent 6d4d47c commit deea284

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/FieldArray.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ function filter(errors, baseName) {
4444
* <Form.FieldArray name="friends" events="blur">
4545
* {({ value, arrayHelpers }) => (
4646
* <ul>
47-
* {value.map((value, idx) => (
47+
* {value.map((item, idx) => (
4848
* <li key={idx} >
4949
* <div style={{ display: 'flex', alignItems: 'flex-start' }}>
5050
* <Form.Field name={`friends[${idx}].name`} />
51-
* <button type="button" onClick={() => arrayHelpers.remove(value)}>-</button>
52-
* <button type="button" onClick={() => arrayHelpers.insert({ name: undefined }, idx)}>+</button>
51+
* <button type="button" onClick={() => arrayHelpers.remove(item)}>-</button>
52+
* <button type="button" onClick={() => arrayHelpers.add({ name: undefined }, idx)}>+</button>
5353
* </div>
5454
* <Form.Message for={`friends[${idx}].name`} />
5555
* </li>

0 commit comments

Comments
 (0)