final-form / final-form/react-final-form

Update FieldRenderProps Documentation to match actual types (type, checked, multiple are missing)

Open
#728 0 comments 10 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.4k
Forks
497
PR merge metrics
No merged PRs in 30d

Description

### Are you submitting a **bug report** or a **feature request**?

Bug report

### What is the current behavior?

The `FieldRenderProps` have three optional properties that are not mentioned in the API Documentation, namely `type`, `checked` and `multiple`.

### What is the expected behavior?

The properties `type`, `checked` and `multiple` are mentioned in the API documention under https://final-form.org/docs/react-final-form/types/FieldRenderProps and explained when they are relevant.

### Sandbox Link

Not applicable

### What's your environment?

Not applicable

### Other information

I was implementing a custom checkbox component that is wrapped bye a `Field` component in order to embed it into a form. My first naiv implementation just mapped the `input.value` of the `FieldRenderProps` to my custom checkbox component. This worked as long as I did not use the `type="checkbox"` on the `Field`. But even though functionally working I got the error stating
```
You must pass `type="checkbox"` prop to your Field(customCheckbox) component. Without it we don't know how to unpack your `value` prop - "undefined".
```
But simply adding the type to the `Field` and still using the `input.value` resulted in strange behavior, since the value property does not get updated by final-form anymore. It is using the `checked` property now. I didn't think of this since it was not documented in the API. Only after finding https://github.com/final-form/react-final-form/issues/182 did I find out that with using the `checked` property everything works as expected.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.