JE42 JE42 - 1 year ago 126
React JSX Question

Debugging React propType warnings

I have propType expressions that sometimes are emitting warnings.

When that happens, I would like to inspect the object causing the warning since the warning message in the console is in same cases not helpful enough.

I tried to debugging through the spec code of react to find the right spot for the breakpoint, however i would expect there is an easier way to get more diagnostic information about the warning.

Answer Source

Want the ugly solution? Because that's all I have.

Stick this in your main application file.

const error = console.error;
console.error = (...args) => {
    error.apply(null, args);

And use the debugger to walk up the callchain till you find checkReactTypeSpec and look at its arguments.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download