Comments (6)
Ah I think I get it now. The question could be why do I explicitly exclude these fields
export interface CheckboxProps
extends FieldProps,
Omit<
MuiCheckboxProps,
'form' | 'checked' | 'defaultChecked' | 'name' | 'onChange' | 'value'
> {}
The reason is that I want exactly one place for state to be stored. That being said modifying state outside of formik happen often enough.
Would this pattern work for you?
https://codesandbox.io/s/goofy-jepsen-2s4f4
Otherwise you can always create your own special case field.
Ciaran
from formik-mui.
Hi @tgrrr, Thanks for the example but I am struggling to see where it is breaking.
Is there a specific reason you have state outside of formik?
const [toggle, setToggle] = useState(false);
looks very strange to me
from formik-mui.
I'm not sure why people wouldn't want control to get + set state outside of Formik itself.
We don't just interact with form components when we hit a submit button.
Some components interact with one another, and other components. Eg. Setting the value on a checkbox hides another component.
The example you copied is just managing state with hooks. It can be swapped out for setState
, redux, or any other state management.
The point is that there's freedom to interact with react's state in Formik. Why wouldn't this also exist in Formik-Material?
from formik-mui.
Yes, I feel like that is exactly the question, thanks.
Would this pattern work for you?
Which pattern do you mean?
from formik-mui.
Why was this closed @cliedeman?
from formik-mui.
Because itβs working as intended. This library delegates all state management to formik.
from formik-mui.
Related Issues (20)
- Add the npm installation script for documentation section
- TextField does not accept numeric value when using react-number-format
- Select contain box overlaps label HOT 2
- Ability to disable default blur handler HOT 6
- Reflect MUI changes regarding Date and Time pickers moved to MUI X from lab HOT 3
- Missing support for freesolo with Autocomplete HOT 1
- GH Pages Deploy Broken
- [DOCS] Reflect MUI changes regarding Date and Time pickers moved to MUI X from lab HOT 2
- when select size
- [BUG Select] Use HTMLElement.dataset to get option values in Select doesn't work HOT 4
- What is the `sxFormControl` in select `formControl` prop HOT 1
- numeric Select values are converted to a string
- Multiline TextField fullWidth is not working HOT 1
- ToggleButtonGroup should disable while submitting
- TextField label gets in the way with initial Chrome autofill value
- Support for Mui X v6 HOT 7
- Usage of `formError` in `fieldToSelect`?
- Date Field
- Following syntax for Autocomplete in docs yields onBlur error, while using the <MuiTextField /> instead "works" HOT 3
- formik-mui-x-date-pickers - The `renderInput` has been replaced by an input component slot props HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from formik-mui.