The state always contains the complete state of all stores ?
See original GitHub issuee.g.:
this.subs.sink = this.auctionsStoreService.stateChanged.subscribe(
(state: AuctionState) => {
state contains all data from all other stores und not just the data that is related to auctions ? is that the expected behavior ?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to choose between Redux's store and React's state ...
Use React for ephemeral state that doesn't matter to the app globally and doesn't mutate in complex ways. For example, a toggle in...
Read more >Redux Fundamentals, Part 3: State, Actions, and Reducers
The official Redux Fundamentals tutorial: learn how reducers update state in response to actions.
Read more >UseState shows previous value always - Stack Overflow
I'm trying to update the state variable using hooks and trying it read the updated value but always it returns a previous value...
Read more >Persist Redux State with redux-persist - DEV Community
It is a package for persisting redux state when it is connected to the store. That's all what the package does. Pretty neat!...
Read more >Hooks API Reference - React
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. This page...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Good deal. That’s typically how I organize the store structure as well.
As far as stateWithPropertyChanges, it fires when setState() is called by the given service (assuming there’s a subscriber) and passes the state that was set as the second parameter. Since you can’t set a nested property directly (due to having to go through the parent property), it won’t be able to pass a nested property that changed when stateWithPropertyChanges fires since there could be several properties that could change all at once.
For example, customer.firstName and customer.lastName could be set together. The customer value would therefore be passed to the subscriber of stateWithPropertyChanges. If you need to compare nested properties then you’d need to compare before and after values wherever you subscribe to stateWithPropertyChanges.
Thanks again for the answer. I now started to give the store more structure by having a property for each service (customer, orders and so on). Which that approach I feel much more comfortable. The only problem so far is, that stateWithPropertyChanges does not work for nested properties.