Closed Nisfan closed 5 years ago
@Nisfan These sort of problems are usually caused by passing invalid parameters in enqueueSnackbar
method.
Please share the code from enqueueSnackbar
that causes this error.
showNotification = (msg, type = 'info') => {
const { enqueueSnackbar } = this.props;
enqueueSnackbar({
message: msg,
options: {
variant: type,
},
});
}
function mapDispatchToProps(dispatch) {
return {
userActions: bindActionCreators(userActions, dispatch),
enqueueSnackbar: bindActionCreators(enqueueSnackbar, dispatch),
}
}
export default connect(mapStateToProps, mapDispatchToProps)(withStyles(loginPageStyle)(LoginPage));
That was it. message
is not an option.
enqueueSnackbar(message, {
variant: 'variant',
});
I actually took it from https://codesandbox.io/s/github/iamhosseindhv/notistack/tree/master/examples/redux-example
const handleClick = () => {
props.enqueueSnackbar({
message: 'Failed fetching data.',
options: {
variant: 'warning',
},
});
};
@Nisfan My mistake I didn't notice it's using redux. I'm sure I can be helpful if you provide a sandbox reproduction.
Bug using Redux example with Material UI
Application is working fine when I don't use Notifier component