Skip to content

Commit a959bb6

Browse files
Fix/Invoke onError only if exists (#1201)
* run onError only if exists * use optional chaining to invoke onError Co-authored-by: Ethan Sharabi <[email protected]> Co-authored-by: Ethan Sharabi <[email protected]>
1 parent 305d10f commit a959bb6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/commons/asBaseComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function asBaseComponent<PROPS, STATICS = {}>(WrappedComponent: React.ComponentT
3333
};
3434

3535
static getDerivedStateFromError(error: any) {
36-
UIComponent.defaultProps?.onError(error, WrappedComponent.defaultProps);
36+
UIComponent.defaultProps?.onError?.(error, WrappedComponent.defaultProps);
3737
return {error: true};
3838
}
3939

0 commit comments

Comments
 (0)