Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Material-UI: A component is changing the default value state of an uncontrolled Select after being initialized. To suppress this warning opt to use a controlled Select.

/** Uncontrolled here means you may be setting the value
of the Select component to undefined, this is because 
value={props.selectedValue} here. In this the props or 
selectedValue may come null so it turns out to be a
uncontrolled component in that.
To solve the warning you can add condition to check null 
and set default value.
*/

value={props.selectedValue ? props.selectedValue : " "}
 
PREVIOUS NEXT
Tagged: #A #component #changing #default #state #uncontrolled #Select #To #suppress #warning #opt #controlled
ADD COMMENT
Topic
Name
9+7 =