react-native-exception-handler icon indicating copy to clipboard operation
react-native-exception-handler copied to clipboard

Returning a component from the error handler

Open ianbayne opened this issue 3 years ago • 0 comments

Hi there, this is a neat project! I discovered it from this post: https://elazizi.com/handling-errors-in-react-native-a-complete-guide.

I have one question: Is it possible to return a component from the errorHandler? Something like the following:

const errorHandler = (error, isFatal) => {
  if (isFatal) {
    return <FallbackComponent />;
  } else {
    console.log(error);
  }  
};

setJSExceptionHandler(errorHandler, true);

export default function App() {
  // ...

ianbayne avatar Nov 19 '20 04:11 ianbayne