Search code examples
javascriptreactjsmaterial-uistrict-mode

Issue with Material-UI Select onChange


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?


Solution

  • 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.