Re:Why I'm Not a React Native Developer
by brhsiao on Tuesday September 27, 2016 @07:49PM
(#12594304)
As someone who loves React, the hardest thing about it for me is debugging. I'll get some error about how renderComponent doesn't accept null values or whatever, and when even the outermost error is so cryptic, the stack trace is even less helpful. Is there a conventional solution to this I'm not aware of?
[ Parent
| on HN ]
Re:Why I'm Not a React Native Developer
by dwaltrip on Tuesday September 27, 2016 @10:40PM
(#12595038)
When the stack trace is inscrutable, I find binary search debugging to be helpful. Comment out half of the functionality, see if the error is still there. Narrow the search to the half that is causing the problem, rinse, and repeat until the offending line of code is found.
However, if the error occurs inconsistently, this approach can be much harder to use.
Re:Why I'm Not a React Native Developer
by darkmarmot on Tuesday September 27, 2016 @10:45PM
(#12595064)
As someone who uses a different component-based js framework, can you not just put a breakpoint in the chrome dev tools on the renderComponent method for that component?
Re:Why I'm Not a React Native Developer
by larsnystrom on Wednesday September 28, 2016 @07:01AM
(#12596744)
renderComponent is not part of any of your components. I think the React equivalent of what you mean is the render method of a component.
The problem I think the OP is talking about is when there is an error thrown somewhere in the react library code (e.g. in renderComponent) and the stack trace doesn't even touch any of your code. That makes it really hard to find the fault behind the error.
This is a lot more common with libraries like RxJS, but I've seen it with React as well.
The only way I know of to deal with these situations is to put console.log calls everywhere in my code until I've narrowed down the source of the bug.
Re:Why I'm Not a React Native Developer
by darkmarmot on Thursday September 29, 2016 @11:58AM
(#12606275)
gotcha, thanks!