@@ -30,7 +30,6 @@ export class Incorporator extends PureComponent<Props, State> {
30
30
super ( props ) ;
31
31
this . state = { flip : false } ;
32
32
this . selector = props . targetProps . sel ;
33
- delete props . targetProps . sel ;
34
33
}
35
34
36
35
private selector : string | symbol ;
@@ -51,13 +50,20 @@ export class Incorporator extends PureComponent<Props, State> {
51
50
return props ;
52
51
}
53
52
54
- public render ( ) {
55
- const { target, targetProps, targetRef, scope} = this . props ;
56
- this . incorporateHandlers ( targetProps , scope ) ;
53
+ private materializeTargetProps ( ) {
54
+ const { targetProps, targetRef, scope} = this . props ;
55
+ let output = { ...targetProps } ;
56
+ output = this . incorporateHandlers ( output , scope ) ;
57
57
if ( targetRef ) {
58
- targetProps . ref = targetRef ;
58
+ output . ref = targetRef ;
59
59
}
60
- delete targetProps . sel ;
60
+ delete output . sel ;
61
+ return output ;
62
+ }
63
+
64
+ public render ( ) {
65
+ const { target} = this . props ;
66
+ const targetProps = this . materializeTargetProps ( ) ;
61
67
if ( targetProps . children ) {
62
68
return createElement ( target , targetProps , targetProps . children ) ;
63
69
} else {
@@ -77,7 +83,7 @@ export function incorporate(type: any) {
77
83
forwardRef < any , any > ( ( props , ref ) =>
78
84
createElement ( ScopeContext . Consumer , null , ( scope : Scope ) =>
79
85
createElement ( Incorporator , {
80
- targetProps : { ... props } ,
86
+ targetProps : props ,
81
87
targetRef : ref ,
82
88
target : type ,
83
89
scope : scope ,
0 commit comments