diff --git a/packages/react-reconciler/src/ReactFiber.new.js b/packages/react-reconciler/src/ReactFiber.new.js index de9c83e3a35dd..95a5340b18730 100644 --- a/packages/react-reconciler/src/ReactFiber.new.js +++ b/packages/react-reconciler/src/ReactFiber.new.js @@ -651,7 +651,10 @@ function createFiberFromProfiler( ): Fiber { if (__DEV__) { if (typeof pendingProps.id !== 'string') { - console.error('Profiler must specify an "id" as a prop'); + console.error( + 'Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.', + typeof pendingProps.id, + ); } } diff --git a/packages/react-reconciler/src/ReactFiber.old.js b/packages/react-reconciler/src/ReactFiber.old.js index f399ab3593146..159557e86a166 100644 --- a/packages/react-reconciler/src/ReactFiber.old.js +++ b/packages/react-reconciler/src/ReactFiber.old.js @@ -651,7 +651,10 @@ function createFiberFromProfiler( ): Fiber { if (__DEV__) { if (typeof pendingProps.id !== 'string') { - console.error('Profiler must specify an "id" as a prop'); + console.error( + 'Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.', + typeof pendingProps.id, + ); } } diff --git a/packages/react/src/__tests__/ReactProfiler-test.internal.js b/packages/react/src/__tests__/ReactProfiler-test.internal.js index ab7fbb73f025a..6b0c02432544b 100644 --- a/packages/react/src/__tests__/ReactProfiler-test.internal.js +++ b/packages/react/src/__tests__/ReactProfiler-test.internal.js @@ -136,9 +136,12 @@ describe('Profiler', () => { it('should warn if required params are missing', () => { expect(() => { ReactTestRenderer.create(); - }).toErrorDev('Profiler must specify an "id" as a prop', { - withoutStack: true, - }); + }).toErrorDev( + 'Profiler must specify an "id" of type `string` as a prop. Received the type `undefined` instead.', + { + withoutStack: true, + }, + ); }); }