react-redux-notify | A simple and flexible notifications component | Notification library
kandi X-RAY | react-redux-notify Summary
kandi X-RAY | react-redux-notify Summary
React redux notify is a simple yet flexible component for displaying notifications. You can simply include the component within your app and use the default settings or you can choose to customize it in many different ways. Easiest way to get up and running is to install it via npm.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Create a new notification
- add a new notification
- remove all notifiers
react-redux-notify Key Features
react-redux-notify Examples and Code Snippets
Community Discussions
Trending Discussions on react-redux-notify
QUESTION
I'm using react-redux-notify
to show notification in my app. I'm using a functional component for my app. I have followed all the guide given on their Github repo. I have shared my code below.
combineReducers.js
...ANSWER
Answered 2019-Sep-24 at 08:02Your code example is not entirely correct. I've looked at the guide on the Github for react-redux-notify. It has a lot of errors and weird code examples, so I see it's easy to get confused.
Your code has the following issues:
Connect
You're first of all need to connect your component to your redux store with connect
. I'm not sure if you're doing it, but it's missing in the code you provided.
createNotification
This is where the code examples in the guide get confusing. The createNotification
is an action that you import from react-redux-notify, just like you're doing. But it's not a method that you can call directly from the component. In redux, actions have to be dispatched from the component. So what you're missing is the dispatch
method that can be retrieved from the component props, when you've connected it to the store. The guide for react-redux-notify suggests using mapDispatchToProps
which is a way of binding a method to dispatch a given action directly to the props of the component.
So your component code should like this:
QUESTION
I learn React Redux and have some issues.
In the code below I do mapStateToProps
to listen for changes and I use the mapDispatchToProps
to send a notification. When there is a change in the Store
I send a Notification. In order for this to work I have to put this Helper
in the App.jsx render()
method even do this Helper
Component code below does not add anything to the App.jsx. I learn React and wonder how I can change this Notefication.js so it listen for mapStateToProps
and can do mapDispatchToProps
without adding it to App.jsx render()
.
It just feels so unnecessary to have to add this Component to the App.jsx render only to get the mapStateToProps
mapDispatchToProps
working?
Notefication.js
...ANSWER
Answered 2019-Jul-06 at 19:52React only renders new, if the component values changes. So if the reducer is connected and you load some values which changes, the component renders and the function will be triggered.
I would not trigger the function this.senNotification
in the render function I would prefer to use componentDidUpdate
to trigger the function.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react-redux-notify
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page