[React] Debug Custom React Hooks With useDebugValue

The useDebugValue hook will not effect your user experience but is instead aimed at improving the developer experience. When building your own custom hooks, useDebugValue can help you debug the hook's internal logic by displaying values in the React Dev Tools.

The hook takes two arguments: a value to be displayed in the developer console and an optional function you can use to format the aforementioned value. The function signature looks like this:

const name = 'ryan'

// Outputs 'ryan' to the developer console
useDebugValue(name);

// Outputs 'RYAN' to the developer console
useDebugValue(name, (name) => name.toUpperCase());

 

上一篇:Mac图片处理:Iridient Developer for Mac(RAW图像格式转换工具)v3.5已激活版


下一篇:xcode dyld: could not load inserted library '/Developer/usr/lib/libBacktraceRecording.dylib