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

[core] Decide if a value belongs in props or context #24450

Open
mbrookes opened this issue Jan 16, 2021 · 1 comment
Open

[core] Decide if a value belongs in props or context #24450

mbrookes opened this issue Jan 16, 2021 · 1 comment
Assignees
Labels
breaking change component: text field This is the name of the generic UI component, not the React module!

Comments

@mbrookes
Copy link
Member

mbrookes commented Jan 16, 2021

I think the actual code smell is computing some variable from context and props. Just like a component instance should either read from state or props (but not switch between) we shouldn't listen to context and props. It's a general issue with our form components where <FormControl disabled><Input disabled={false} /></FormControl> is allowed for some reason. The disabled state should live at a single point.

In v5 we should revisit this and decide if something lives in props or context.

Originally posted by @eps1lon in #19319 (comment)

Related:

@michaldudak
Copy link
Member

In MUI Base, if an input is inside a FormControlUnstyled, it cannot have its own props (it applies to the props that can be set on a form control). Having props in such case will trigger a warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change component: text field This is the name of the generic UI component, not the React module!
Projects
Status: Backlog
Development

No branches or pull requests

5 participants