Reputation: 3
I am learning redux with react and I have one question regarding the use of it. Does redux update the view after a database field value has changed? Does the update happen on all the opened windows?
For example I have a table with some invoices. I update the value of one invoice but the view does not update without reloading the page. After I update the view using callback function the view updates on the current opened window, but not on other opened window in other browser.
I can't attache code because I don't have copyright on it.
Upvotes: 0
Views: 65
Reputation: 2142
Redux is a predictable state container.
Meaning, it is just a store which you can update when something changes. Components which are subscribed to the store, by using connect mapping store state to the props of the component, will be rerendered when there is a change in object.
So if your view has different components which uses same prop from redux store, all components will be rerendered, when the value changes.
After I update the view using callback function the view updates on the current opened window, but not on other opened window in other browser.
Another browser tab won't be updated. That is a different window altogether with it's own context and DOM elements :) You should use some event based communication like Socket.io to achieve real time changes in all windows.
Upvotes: 1