From b06a1f4364b8dabca3e539bee24a60b3aaa25414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Tue, 7 Sep 2021 23:20:46 +0200 Subject: [PATCH] refactoring --- packages/react/src/ReactRenderer.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/react/src/ReactRenderer.tsx b/packages/react/src/ReactRenderer.tsx index 249571e2..560e8103 100644 --- a/packages/react/src/ReactRenderer.tsx +++ b/packages/react/src/ReactRenderer.tsx @@ -10,7 +10,10 @@ function isClassComponent(Component: any) { } function isForwardRefComponent(Component: any) { - return !!(typeof Component === 'object' && Component.$$typeof?.toString() === 'Symbol(react.forward_ref)') + return !!( + typeof Component === 'object' + && Component.$$typeof?.toString() === 'Symbol(react.forward_ref)' + ) } export interface ReactRendererOptions { @@ -19,10 +22,10 @@ export interface ReactRendererOptions { as?: string, } -type ComponentType = React.Component | React.FunctionComponent | React.ForwardRefExoticComponent<{ - items: any[]; - command: any; -} & React.RefAttributes> +type ComponentType = + | React.Component + | React.FunctionComponent + | React.ForwardRefExoticComponent<{ items: any[], command: any } & React.RefAttributes> export class ReactRenderer { id: string @@ -53,7 +56,7 @@ export class ReactRenderer { const Component = this.component const props = this.props - if (isClassComponent(Component) || isForwardRefComponent(Component)) { + if (isClassComponent(Component) || isForwardRefComponent(Component)) { props.ref = (ref: React.Component) => { this.ref = ref }