useDebugValue

Learn how to display a label for custom Hooks in React DevTools.

Assign a label to custom Hooks

The useDebugValue() Hook is used purely for optimizing the developer’s debugging experience. We call it in the following way:

useDebugValue(value);

It doesn’t create any real value in an application for the end user. useDebugValue() allows us to give custom Hooks a label that we can then inspect in the React DevTools:

import React from 'react';
import ReactDOM from 'react-dom';
import App from './app.js';
require('./style.css');

ReactDOM.render(
  <App />, 
  document.getElementById('root')
);

In this example, we have implemented a Hook ...