@@ -16,6 +16,7 @@ require('../source/modules/smart.accordion');
1616 class AccordionItem extends React . Component {
1717 constructor ( props ) {
1818 super ( props ) ;
19+ this . componentRef = React . createRef ( ) ;
1920 }
2021 // Gets the id of the React component.
2122 get id ( ) {
@@ -96,7 +97,7 @@ require('../source/modules/smart.accordion');
9697 props [ prop ] = that . props [ prop ] ;
9798 }
9899 if ( initialize ) {
99- that . nativeElement = this . refs [ this . id ] ;
100+ that . nativeElement = this . componentRef . current ;
100101 }
101102 for ( let prop in props ) {
102103 if ( prop === 'class' ) {
@@ -159,7 +160,7 @@ require('../source/modules/smart.accordion');
159160 }
160161 }
161162 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 ) ) ;
163164 }
164165 }
165166
@@ -170,6 +171,7 @@ require('../source/modules/smart.accordion');
170171 class Accordion extends React . Component {
171172 constructor ( props ) {
172173 super ( props ) ;
174+ this . componentRef = React . createRef ( ) ;
173175 }
174176 // Gets the id of the React component.
175177 get id ( ) {
@@ -405,7 +407,7 @@ require('../source/modules/smart.accordion');
405407 props [ prop ] = that . props [ prop ] ;
406408 }
407409 if ( initialize ) {
408- that . nativeElement = this . refs [ this . id ] ;
410+ that . nativeElement = this . componentRef . current ;
409411 }
410412 for ( let prop in props ) {
411413 if ( prop === 'class' ) {
@@ -468,7 +470,7 @@ require('../source/modules/smart.accordion');
468470 }
469471 }
470472 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 ) ) ;
472474 }
473475 }
474476
0 commit comments