DEV Community

loading...

Discussion on: Using React ErrorBoundary with HOCs

Collapse
olesbolotniuk profile image
oles-bolotniuk

Registered on this resource just to say thank you!

I've modified your example so decorator would accept options like this
@withErrorBoundary({ componentName: ' . . . ' })
and we could handle errors in uglified/minified production build

For anyone wondering - the wrapper will look like this

export default options => Component => props => {
  return (
    <ErrorBoundary options={ options }>
      <Component { ...props } />
    </ErrorBoundary>
  );
};

Then ErrorBoundary component will receive options object as a prop (obviously)

Thanks for sharing!