File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -267,8 +267,8 @@ export default function connectAdvanced(
267267
268268 if ( prefixUnsafeLifecycleMethods ) {
269269 // Use UNSAFE_ event name where supported
270- Connect . UNSAFE_componentWillReceiveProps = Connect . componentWillReceiveProps
271- delete Connect . componentWillReceiveProps
270+ Connect . prototype . UNSAFE_componentWillReceiveProps = Connect . prototype . componentWillReceiveProps
271+ delete Connect . prototype . componentWillReceiveProps
272272 }
273273
274274 /* eslint-enable react/no-deprecated */
@@ -280,7 +280,9 @@ export default function connectAdvanced(
280280 Connect . propTypes = contextTypes
281281
282282 if ( process . env . NODE_ENV !== 'production' ) {
283- Connect . prototype . componentWillUpdate = function componentWillUpdate ( ) {
283+ // Use UNSAFE_ event name where supported
284+ const eventName = prefixUnsafeLifecycleMethods ? 'UNSAFE_componentWillUpdate' : 'componentWillUpdate' ;
285+ Connect . prototype [ eventName ] = function componentWillUpdate ( ) {
284286 // We are hot reloading!
285287 if ( this . version !== version ) {
286288 this . version = version
You can’t perform that action at this time.
0 commit comments