Answer the question
In order to leave comments, you need to log in
How to properly implement Reducer Notification?
And here I am again with my idiotic questions. I still can't think of an adequate solution for creating an alert component.
It is necessary to create notification's during actions with fields: type, text, time.
Those. alert type, content, and lifetime. How to implement it correctly?
Every time during the action, parse the this.props.layout.notifications array, add another element by push and write it down again? If not, how to proceed in order not to create a new reducer?
Answer the question
In order to leave comments, you need to log in
Every time I need to trigger a notification event (be it a new notification or a deletion of an old one), I need to fetch the existing this.props.layout.notification array, modify it, and send it back to overwrite
dispatch({
type: 'ADD_NOTIFICATION',
payload: { notification: { ... } },
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question