File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -133,15 +133,18 @@ class ReactTooltip extends React.Component {
133133    this . bindWindowEvents ( resizeHide )  // Bind global event for static method 
134134  } 
135135
136-   componentWillReceiveProps  ( props )  { 
137-     const  {  ariaProps }  =  this . state 
138-     const  newAriaProps  =  parseAria ( props ) 
139- 
136+   static  getDerivedStateFromProps  ( nextProps ,  prevState )  { 
137+     const  {  ariaProps }  =  prevState 
138+     const  newAriaProps  =  parseAria ( nextProps ) 
140139    const  isChanged  =  Object . keys ( newAriaProps ) . some ( props  =>  { 
141140      return  newAriaProps [ props ]  !==  ariaProps [ props ] 
142141    } ) 
143-     if  ( isChanged )  { 
144-       this . setState ( {  ariaProps : newAriaProps  } ) 
142+     if  ( ! isChanged )  { 
143+       return  null 
144+     } 
145+     return  { 
146+       ...prevState , 
147+       ariaProps : newAriaProps 
145148    } 
146149  } 
147150
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments