Material UI Select throwing error
See original GitHub issueWhen wrapping the Select Component with Controller I get this error (The NativeSelect Component from MUI works as expected.):
Material-UI: A component is changing the uncontrolled value state of Select to be controlled.
Elements should not switch from uncontrolled to controlled (or vice versa).
Decide between using a controlled or uncontrolled Select element for the lifetime of the component.
The nature of the state is determined during the first render, it's considered controlled if the value is not `undefined`.
My sample code is:
<FormControl >
<InputLabel>Priority</InputLabel>
<Controller
as={
<Select>
<MenuItem value="low">Low</MenuItem>
<MenuItem value="high">High</MenuItem>
</Select>
}
name="priority"
native={false}
control={control}
/>
</FormControl>
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to make a 'Select' component as required in Material UI ...
For setting a required Select field with Material UI, you can do: class SimpleSelect extends React.PureComponent { state = { selected: null, ...
Read more >React Select component - Material UI - MUI
Select components are used for collecting user provided information from a list of options.
Read more >Using Material UI with React Hook Form - LogRocket Blog
Learn how to use Material UI with React Hook Form by building a complete ... a Controller component from React Hook Form, it...
Read more >Material UI Example - Redux Form
For Material UI, @erikras has published a set of wrapper components to use ... error}> <InputLabel htmlFor="age-native-simple">Age</InputLabel> <Select ...
Read more >Material UI multi select problem - The freeCodeCamp Forum
How do I make it display like the dropdown list item? I did try to type selected[i18n.language].join(', ') but it throws an error...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes. This solves the problem. Maybe this should be documented as it is not very intuitive. NativeSelect does not need the defaultValue parameter and all the samples I could find use NativeSelect.
This is happening to me too. @acrellin have you been able to fix this ?