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 {
133
133
this . bindWindowEvents ( resizeHide ) // Bind global event for static method
134
134
}
135
135
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 )
140
139
const isChanged = Object . keys ( newAriaProps ) . some ( props => {
141
140
return newAriaProps [ props ] !== ariaProps [ props ]
142
141
} )
143
- if ( isChanged ) {
144
- this . setState ( { ariaProps : newAriaProps } )
142
+ if ( ! isChanged ) {
143
+ return null
144
+ }
145
+ return {
146
+ ...prevState ,
147
+ ariaProps : newAriaProps
145
148
}
146
149
}
147
150
You can’t perform that action at this time.
0 commit comments