@@ -35,14 +35,14 @@ export default function connectAdvanced(
35
35
// probably overridden by wrapper functions such as connect()
36
36
methodName = 'connectAdvanced' ,
37
37
38
- // if defined, the name of the property passed to the wrapped element indicating the number of
38
+ // REMOVED: if defined, the name of the property passed to the wrapped element indicating the number of
39
39
// calls to render. useful for watching in react devtools for unnecessary re-renders.
40
40
renderCountProp = undefined ,
41
41
42
42
// determines whether this HOC subscribes to store changes
43
43
shouldHandleStateChanges = true ,
44
44
45
- // the key of props/context to get the store [**does nothing, use consumer**]
45
+ // REMOVED: the key of props/context to get the store
46
46
storeKey = 'store' ,
47
47
48
48
// REMOVED: expose the wrapped component via refs
@@ -66,11 +66,13 @@ export default function connectAdvanced(
66
66
"withRef is removed. To access the wrapped instance, use a ref on the connected component"
67
67
)
68
68
69
+ const customStoreWarningMessage = 'To use a custom Redux store for specific components, create a custom React context with ' +
70
+ 'React.createContext(), and pass the context object to React-Redux\'s Provider and specific components' +
71
+ ' like: <Provider context={MyContext}><ConnectedComponent context={MyContext} /></Provider>. ' +
72
+ 'You may also pass a {context : MyContext} option to connect'
73
+
69
74
invariant ( storeKey === 'store' ,
70
- 'storeKey has been removed and does not do anything. To use a custom redux store for a single component, ' +
71
- 'create a custom React context with React.createContext() and pass the Provider to react-redux\'s provider ' +
72
- 'and the Consumer to this component as in <Provider context={context.Provider}><' +
73
- 'ConnectedComponent consumer={context.Consumer} /></Provider>'
75
+ 'storeKey has been removed and does not do anything. ' + customStoreWarningMessage
74
76
)
75
77
76
78
@@ -103,7 +105,7 @@ export default function connectAdvanced(
103
105
}
104
106
}
105
107
PureWrapperRef . propTypes = {
106
- derivedProps : propTypes . object ,
108
+ // derivedProps: propTypes.object,
107
109
forwardRef : propTypes . oneOfType ( [
108
110
propTypes . func ,
109
111
propTypes . object
@@ -121,7 +123,7 @@ export default function connectAdvanced(
121
123
}
122
124
}
123
125
PureWrapperNoRef . propTypes = {
124
- derivedProps : propTypes . object ,
126
+ // derivedProps: propTypes.object,
125
127
}
126
128
PureWrapper = PureWrapperNoRef
127
129
}
@@ -144,11 +146,7 @@ export default function connectAdvanced(
144
146
constructor ( props ) {
145
147
super ( props )
146
148
invariant ( forwardRef ? ! props . props [ storeKey ] : ! props [ storeKey ] ,
147
- 'Passing redux store in props has been removed and does not do anything. ' +
148
- 'To use a custom redux store for a single component, ' +
149
- 'create a custom React context with React.createContext() and pass the Provider to react-redux\'s provider ' +
150
- 'and the Consumer to this component\'s connect as in <Provider context={context.Provider}></Provider>' +
151
- ` and connect(mapState, mapDispatch, undefined, { consumer=context.consumer })(${ wrappedComponentName } )`
149
+ 'Passing redux store in props has been removed and does not do anything. ' + customStoreWarningMessage
152
150
)
153
151
this . generatedDerivedProps = this . makeDerivedPropsGenerator ( )
154
152
this . renderWrappedComponent = this . renderWrappedComponent . bind ( this )
@@ -213,13 +211,6 @@ export default function connectAdvanced(
213
211
}
214
212
215
213
render ( ) {
216
- if ( this . props . unstable_observedBits ) {
217
- return (
218
- < Context . Consumer unstable_observedBits = { this . props . unstable_observedBits } >
219
- { this . renderWrappedComponent }
220
- </ Context . Consumer >
221
- )
222
- }
223
214
return (
224
215
< Context . Consumer >
225
216
{ this . renderWrappedComponent }
0 commit comments