@@ -16,6 +16,7 @@ require('../source/modules/smart.accordion');
16
16
class AccordionItem extends React . Component {
17
17
constructor ( props ) {
18
18
super ( props ) ;
19
+ this . componentRef = React . createRef ( ) ;
19
20
}
20
21
// Gets the id of the React component.
21
22
get id ( ) {
@@ -96,7 +97,7 @@ require('../source/modules/smart.accordion');
96
97
props [ prop ] = that . props [ prop ] ;
97
98
}
98
99
if ( initialize ) {
99
- that . nativeElement = this . refs [ this . id ] ;
100
+ that . nativeElement = this . componentRef . current ;
100
101
}
101
102
for ( let prop in props ) {
102
103
if ( prop === 'class' ) {
@@ -159,7 +160,7 @@ require('../source/modules/smart.accordion');
159
160
}
160
161
}
161
162
render ( ) {
162
- return ( React . createElement ( "smart-accordion-item" , { ref : this . id } , this . props . children ) ) ;
163
+ return ( React . createElement ( "smart-accordion-item" , { ref : this . componentRef } , this . props . children ) ) ;
163
164
}
164
165
}
165
166
@@ -170,6 +171,7 @@ require('../source/modules/smart.accordion');
170
171
class Accordion extends React . Component {
171
172
constructor ( props ) {
172
173
super ( props ) ;
174
+ this . componentRef = React . createRef ( ) ;
173
175
}
174
176
// Gets the id of the React component.
175
177
get id ( ) {
@@ -405,7 +407,7 @@ require('../source/modules/smart.accordion');
405
407
props [ prop ] = that . props [ prop ] ;
406
408
}
407
409
if ( initialize ) {
408
- that . nativeElement = this . refs [ this . id ] ;
410
+ that . nativeElement = this . componentRef . current ;
409
411
}
410
412
for ( let prop in props ) {
411
413
if ( prop === 'class' ) {
@@ -468,7 +470,7 @@ require('../source/modules/smart.accordion');
468
470
}
469
471
}
470
472
render ( ) {
471
- return ( React . createElement ( "smart-accordion" , { ref : this . id } , this . props . children ) ) ;
473
+ return ( React . createElement ( "smart-accordion" , { ref : this . componentRef } , this . props . children ) ) ;
472
474
}
473
475
}
474
476
0 commit comments