fix: warning when a non-boolean values was used to set `checked` prop of a SwitchInput component (#3276)
fix: warning when a non-boolean values was used to set`checked` prop of SwitchInput component The problem was that in the useEffect hook the plain value was used without validation like in useState
This commit is contained in:
parent
da0a15eee1
commit
99cb8c32cb
|
|
@ -6,7 +6,7 @@ export const SwitchInput = ({ label, value, onChange, disabled = false }) => {
|
|||
const [myValue, setMyValue] = useState(value !== undefined ? !!value : false)
|
||||
|
||||
useEffect(() => {
|
||||
setMyValue(value)
|
||||
setMyValue(value !== undefined ? !!value : false)
|
||||
}, [value])
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in New Issue