Skip to content

Commit

Permalink
Add .propTypes and .displayName assignments with __DEV__ check
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Nov 22, 2019
1 parent 5e0c50d commit 089aca7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/components/Context.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react'

export const ReactReduxContext = React.createContext(null)
export const ReactReduxContext = /*#__PURE__*/ React.createContext(null)

ReactReduxContext.displayName = 'ReactRedux'
if (process.env.NODE_ENV !== 'production') {
ReactReduxContext.displayName = 'ReactRedux'
}

export default ReactReduxContext
18 changes: 10 additions & 8 deletions src/components/Provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ function Provider({ store, context, children }) {
return <Context.Provider value={contextValue}>{children}</Context.Provider>
}

Provider.propTypes = {
store: PropTypes.shape({
subscribe: PropTypes.func.isRequired,
dispatch: PropTypes.func.isRequired,
getState: PropTypes.func.isRequired
}),
context: PropTypes.object,
children: PropTypes.any
if (process.env.NODE_ENV !== 'production') {
Provider.propTypes = {
store: PropTypes.shape({
subscribe: PropTypes.func.isRequired,
dispatch: PropTypes.func.isRequired,
getState: PropTypes.func.isRequired
}),
context: PropTypes.object,
children: PropTypes.any
}
}

export default Provider

0 comments on commit 089aca7

Please sign in to comment.