diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.internal.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.internal.js index 2e585a1373a22..7cd436c4ed2f6 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.internal.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.internal.js @@ -26,6 +26,7 @@ let useMemo; let useRef; let useImperativeHandle; let useLayoutEffect; +let useDebugValue; let forwardRef; let yieldedValues; let yieldValue; @@ -48,6 +49,7 @@ function initModules() { useCallback = React.useCallback; useMemo = React.useMemo; useRef = React.useRef; + useDebugValue = React.useDebugValue; useImperativeHandle = React.useImperativeHandle; useLayoutEffect = React.useLayoutEffect; forwardRef = React.forwardRef; @@ -658,4 +660,16 @@ describe('ReactDOMServerHooks', () => { 'Hooks can only be called inside the body of a function component.', ); }); + + describe('useDebugValue', () => { + itRenders('is a noop', async render => { + function Counter(props) { + const debugValue = useDebugValue(123); + return ; + } + + const domNode = await render(); + expect(domNode.textContent).toEqual('undefined'); + }); + }); }); diff --git a/packages/react-dom/src/server/ReactPartialRendererHooks.js b/packages/react-dom/src/server/ReactPartialRendererHooks.js index d5ca03dee81aa..6eb62c7bd7c2d 100644 --- a/packages/react-dom/src/server/ReactPartialRendererHooks.js +++ b/packages/react-dom/src/server/ReactPartialRendererHooks.js @@ -351,6 +351,8 @@ export const Dispatcher = { useImperativeHandle: noop, // Effects are not run in the server environment. useEffect: noop, + // Debugging effect + useDebugValue: noop, }; export const DispatcherWithoutHooks = { readContext,