title: Capturing React Errors Globally
body: <p>I'm new to React. I want to capture all react uncaught and unexpected errors/warnings and i would like to log the errors to an external api.  I know its possible by Try Catch method but I'm planning to have it globally so that other developer need not to write the code each and every time. </p>
  
  <p>I tried <code>window.onerror/addEventListener('error', function(e){}</code> which only captures the Javascript errors but not react errors.</p>
  
  <p>This is similar to following post <a href="https://stackoverflow.com/questions/29268791/how-do-i-handle-exceptions">How do I handle exceptions?</a>. But the solution given didn't meet my needs.</p>
  
  <p>Can someone help me on this?</p>