We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
componentWillReceiveProps
1 parent 34fa8cb commit 80b71edCopy full SHA for 80b71ed
src/index.js
@@ -133,15 +133,18 @@ class ReactTooltip extends React.Component {
133
this.bindWindowEvents(resizeHide) // Bind global event for static method
134
}
135
136
- componentWillReceiveProps (props) {
137
- const { ariaProps } = this.state
138
- const newAriaProps = parseAria(props)
139
-
+ static getDerivedStateFromProps (nextProps, prevState) {
+ const { ariaProps } = prevState
+ const newAriaProps = parseAria(nextProps)
140
const isChanged = Object.keys(newAriaProps).some(props => {
141
return newAriaProps[props] !== ariaProps[props]
142
})
143
- if (isChanged) {
144
- this.setState({ ariaProps: newAriaProps })
+ if (!isChanged) {
+ return null
+ }
145
+ return {
146
+ ...prevState,
147
+ ariaProps: newAriaProps
148
149
150
0 commit comments