Skip to content

Commit

Permalink
[core] Add comment about Object.js
Browse files Browse the repository at this point in the history
Complement a bit #42571
  • Loading branch information
oliviertassinari committed Jun 8, 2024
1 parent 3c0b821 commit 93e72f5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/mui-utils/src/useControlled/useControlled.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export default function useControlled({ controlled, default: defaultProp, name,
const { current: defaultValue } = React.useRef(defaultProp);

React.useEffect(() => {
// Object.is() is not equivalent to the === operator.
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is for more details.
if (!isControlled && !Object.is(defaultValue, defaultProp)) {
console.error(
[
Expand Down

0 comments on commit 93e72f5

Please sign in to comment.