-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to dispatch the ShowAlert function through the reducer? #15
Comments
Hi @twolips. I am currently implementing MessageBar via Redux reducers and this is what I'm doing for it:
componentWillReceiveProps (nextProps) {
const nextMessageBar = nextProps.messageBar
const { messageBar } = this.props
if (nextMessageBar && nextMessageBar.message && messageBar !== nextMessageBar) {
MessageBarManager.showAlert({...nextMessageBar})
}
} This code will only fire when some action updates the message bar reducer thus showing what was added to this reducer. Note that the code above is pseudo code so take it with a grain of salt |
@gabceb could you please illustrate this? |
How exactly should I illustrate it @salhotra ? The code I posted should be enough to plug into a project |
@gabceb I was able to get it to work. Thanks |
I'm trying to use the ShowAlert function for logout success messages and error messages. The problem is my actions are tucked away in another file that isn't a child component of my the main parent component. Is there any way to feed the Alert action through the redux store and have RegisterMessageBar function listen for the alert? I didn't know how to classify this as a question as opposed to an issue. I realize in the documentation it specifically mentions it needs to be a child component but I still thought I'd try my luck and ask. Thanks in advance!
The text was updated successfully, but these errors were encountered: