Skip to content

Commit 93e72f5

Browse files
[core] Add comment about Object.js
Complement a bit #42571
1 parent 3c0b821 commit 93e72f5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/mui-utils/src/useControlled/useControlled.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export default function useControlled({ controlled, default: defaultProp, name,
2929
const { current: defaultValue } = React.useRef(defaultProp);
3030

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

0 commit comments

Comments
 (0)