Skip to content

Commit

Permalink
fix: add hoist-non-react-statics
Browse files Browse the repository at this point in the history
  • Loading branch information
ds009 committed Apr 6, 2019
1 parent 6072e25 commit cdeb8cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@
"react-dom": "^16.8.0"
},
"dependencies": {
"prop-types": "^15.6.2",
"classnames": "^2.2.6"
"classnames": "^2.2.6",
"hoist-non-react-statics": "^3.3.0",
"prop-types": "^15.6.2"
},
"bugs": {
"url": "https://github.com/iamhosseindhv/notistack/issues"
Expand Down
3 changes: 2 additions & 1 deletion src/withSnackbar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
import SnackbarContext from './SnackbarContext';

const withSnackbar = (Component) => {
Expand All @@ -13,7 +14,7 @@ const withSnackbar = (Component) => {
)}
</SnackbarContext.Consumer>
);

hoistNonReactStatics(WrappedComponent, Component);
WrappedComponent.displayName = `withSnackbar(${Component.displayName || Component.name || 'Component'})`;

return WrappedComponent;
Expand Down

0 comments on commit cdeb8cc

Please sign in to comment.