3 ms·
Hey, Thanks, you are right! Do you have a good suggestion on a syntax how people could use the "debugger" in a nice way? I kinda dislike first creating a comp
by skurfuerst 10y ago
Hey,
Thanks, you are right!
Do you have a good suggestion on a syntax how people could use the "debugger" in a nice way? I kinda dislike first creating a component and then wrapping it completely afterwards, although that of course would work.
All the best,
Sebastian
- jkrems 10y agoYou could just imperatively instrument the component, e.g.: class MyComponent extends React.Component { /* ... */ } debugReasonForRendering(MyComponent); Where `debugReasonForRendering` patches `arguments[0].prototype. shouldComponentUpdate`.
- adriancooney 10y agoSince this is entirely for debugging purposes, I feel like the decorator is perfectly fine until the standard is complete. It's unobtrusive (i.e. no refactoring needed) and easy to remember. Maybe a warning inside the decorator is `process.env.NODE_ENV === "production"` warning would be nice.