is there any good debugging toool for finding the exact line numbers or Component names where we got the error like
Uncaught TypeError: Cannot read property '__reactInternalInstance$mdm22afavg17ndrawaq8e61or' of null
is only adding console logs for every file is the solution ????????
If you have an error like this, you likely have an earlier error which got React into an inconsistent state. If you use Promises, you might be catching those errors by mistake, and so they never appear in the console.
If you think this is a React bug, please provide a fiddle reproducing the issue.
Closing due to lack of details and no response.
Can you better define getting react into an inconsistent state? What are common problems that would lead this to happen?
If React component throws in a render or a lifecycle method, it is likely to get into that state.
The next update to an already broken tree will throw these meaningless errors.
This will be fixed in future versions (in which we'll support error boundaries).
A small update on this. We just released React 16 beta which shouldn鈥檛 emit cryptic errors like this one. Even if the application code swallows an error, React 16 will still print it to the console. It might be too early for you to try React 16 (since ecosystem is still preparing for it), but this error should never occur in the future after you switch to it.
I have an example how this error appeared.
it('should componentDidMount', () => {
const wrapper = ReactTestUtils.renderIntoDocument(<Component />);
wrapper.updater.isMounted();
});
Right now we are using 15.5.
Make sure to call wrapper.update()
before the method is throwing the error (like wrapper.simulate()
). I think that of error is thrown (enzyme) when the wrapper points to nodes that no longer exists (because the page was re-rendered or the original nodes replaced/changed for some reason ). update()
solved the problem in my case ( error thrown when calling wrapper.simulate()
- working with enzyme / jsdom)
In my case was a little mistake, I was doing wrapper.simulate('submit')
instead of wrapper.find('form').simulate('submit')
Most helpful comment
A small update on this. We just released React 16 beta which shouldn鈥檛 emit cryptic errors like this one. Even if the application code swallows an error, React 16 will still print it to the console. It might be too early for you to try React 16 (since ecosystem is still preparing for it), but this error should never occur in the future after you switch to it.