-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Field type="checkbox", recommended way? #602
Comments
Depends on your use case, of course... |
What about using a FieldArray for this purpose? |
Can anyone give a simpler answer to the original question? @Andreyco 's example is more complex: it supports an array of checkboxes. |
I believed it is maintained automatically like value. I tried with a simple use case like @Andreyco and it works; here - https://codesandbox.io/s/sleepy-shannon-lpe81. |
It is (mostly) maintained automatically. You still have to manage the checked state from the initial values. Here is a fork of @ameenaliu code sandbox: https://codesandbox.io/s/ecstatic-monad-58kjq |
I couldn't believe that the checkbox would be so hard working with Formik. Anyway, I found a very simple way to work with it. This is the MUI checkbox but I think with will work for native input checkbox as well.
The |
Hello, I leave you an example of Checkbox with SUIR, greetings!
|
Bug, Feature, or Question?
Question
the question
when using a
<Field component="input" type="checkbox">
component to represent a checkbox, it seems i have to manually maintain thechecked
attribute, like this:is this the recommended approach?
i am just unsure, because the
value
attribute is maintained automatically, unlikechecked
.The text was updated successfully, but these errors were encountered: