(Wrapped: ComponentType<any>)
| 8 | } |
| 9 | |
| 10 | function withErrorBoundary<V>(Wrapped: ComponentType<any>) { |
| 11 | return (routeProps: RouteRenderArgs) => { |
| 12 | const { props, match } = routeProps |
| 13 | const renderProps = props as ViewRenderProps<V> |
| 14 | const view = renderProps?.view |
| 15 | return ( |
| 16 | view && ( |
| 17 | <ErrorBoundary> |
| 18 | <Wrapped view={view} match={match} /> |
| 19 | </ErrorBoundary> |
| 20 | ) |
| 21 | ) |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | export default withErrorBoundary |