You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vinibiavatti1 edited this page Sep 28, 2026
·
2 revisions
Adds a custom label to custom Hooks in React Developer Tools to simplify debugging. It should only be called inside custom Hooks and has zero performance overhead in production.
import{useState,useDebugValue}from'react';exportconstuseAuth=()=>{const[isAuthenticated,setAuthenticated]=useState(false);// Displays formatted label next to useAuth in React DevToolsuseDebugValue(isAuthenticated ? 'Authenticated' : 'Not Authenticated');return[isAuthenticated,setAuthenticated];};