Issue with Material-UI Select onChange Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Issue with Material-UI Select onChange without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I’m using Material-UI select and unable to access select value as I am getting the warning:

index.js:1 Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference.

Here is the code that I am using as part of my Select:

const [myType, setMyType] = useState('');

<Select
  name="myTypeNm"
  label="Type"
  onChange={(e) => {setMyType(e.target.value)}}
  options={myTypes}
/>

when I attempt to display {myType} on screen, nothing appears.

Is there a fix for this as I seem to be only getting this error when changing material-ui select values?

Answer

That is a Material UI minor bug. So it’s not very important so your code can work normally. You only need ignore it. I recommend you to report it to Material UI Github repository to fix it in the next versions.

We are here to answer your question about Issue with Material-UI Select onChange - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji