Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix API doc for Field component #2561

Open
leonbloy opened this issue Jun 27, 2020 · 6 comments
Open

Fix API doc for Field component #2561

leonbloy opened this issue Jun 27, 2020 · 6 comments

Comments

@leonbloy
Copy link

It's frustrating that the docs for the fundamental <Field> component is so messed up.

formik

@leonbloy
Copy link
Author

leonbloy commented Jun 27, 2020

The docs in general, are quite chaotic (to put it mildly)

Formik: https://jaredpalmer.com/formik/docs/api/formik

There are two kind of props here: the ones for <Formik> , and the ones that are passed by Formik to the render function.

It's hard to distinguish them

image

@leonbloy
Copy link
Author

More in https://jaredpalmer.com/formik/docs/api/field

field: An object containing onChange, onBlur, name, and value of the field (see FieldInputProps)
form: The Formik bag
meta: An object containing metadata (i.e. value, touched, error, and initialValue) about the field (see FieldMetaProps)

The two "see..." parentheses, have broken links.
And "Formik bag" should have some (preferably non broken) link that explains what a Formik bag is.

@johnrom
Copy link
Collaborator

johnrom commented Jun 27, 2020

You are free to open a PR with these revisions!

@leonbloy
Copy link
Author

leonbloy commented Jun 28, 2020

@johnrom I'll try to summit some fixes - but the problem is that to fix some docs we need to understand the API, and to understand the API we need ... to read the docs (unless we are Formik developers).
I cannot correct the inconsistencies because I don't know which of the contradicting informations is right. In particular, I'd love to know if "component" is actually deprecated for Field,...but I don't know.

@michael-swarm
Copy link

michael-swarm commented Jul 31, 2020

@leonbloy I think I found the answer to this question in an old issue -- component was briefly deprecated, but then intentionally un-deprecated for reasons cited below. The issue also has a great explanation of the difference between as and component, which could really use some clarification in the documentation. See: #1371 (comment) and #1915

@lucien-perouze-cezembre

Why shouldn't components gets metas ? In the code there is this comment before creating component in Field :
// We don't pass meta for backwards compat

Why would that be an issue ?

I would really like to use components on Field as it's way cleaner. I just moved from redux-form and all my Fields are components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants