Skip to content

Commit 9fc5993

Browse files
Andaristtimdorr
authored andcommitted
Wrap .propTypes and .displayName assignments with __DEV__ check (#1471)
1 parent 5e0c50d commit 9fc5993

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/components/Context.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import React from 'react'
22

3-
export const ReactReduxContext = React.createContext(null)
3+
export const ReactReduxContext = /*#__PURE__*/ React.createContext(null)
44

5-
ReactReduxContext.displayName = 'ReactRedux'
5+
if (process.env.NODE_ENV !== 'production') {
6+
ReactReduxContext.displayName = 'ReactRedux'
7+
}
68

79
export default ReactReduxContext

src/components/Provider.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,16 @@ function Provider({ store, context, children }) {
3333
return <Context.Provider value={contextValue}>{children}</Context.Provider>
3434
}
3535

36-
Provider.propTypes = {
37-
store: PropTypes.shape({
38-
subscribe: PropTypes.func.isRequired,
39-
dispatch: PropTypes.func.isRequired,
40-
getState: PropTypes.func.isRequired
41-
}),
42-
context: PropTypes.object,
43-
children: PropTypes.any
36+
if (process.env.NODE_ENV !== 'production') {
37+
Provider.propTypes = {
38+
store: PropTypes.shape({
39+
subscribe: PropTypes.func.isRequired,
40+
dispatch: PropTypes.func.isRequired,
41+
getState: PropTypes.func.isRequired
42+
}),
43+
context: PropTypes.object,
44+
children: PropTypes.any
45+
}
4446
}
4547

4648
export default Provider

0 commit comments

Comments
 (0)