You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When mapping state to props in redux connect I ended up with something that looks like a part of code that belongs to the reducer. However, because I use the reducer created by the library there is no obvious way (for me at least) to combine two reducers so they work on the same part of store. The reducer created by redux-dsm is responsible for assuring that actions are dispatched in proper order and update state only in such case. My reducer would be responsible for populating the state with correctly shaped data.
I thought about it and for me it seems that the redux-dsm reducer responsibility could be replaced with a middleware. So the redux-dsm library would return a middleware which when applied would assure that actions are dispatched in right order.
Before I dig into the implementation I would like to know what you think about it and maybe how to solve the problem I mentioned with different means.
The text was updated successfully, but these errors were encountered:
I worked on simple application which uses the redux-dsm library and I stumbled upon one problem.
Example code: #21
The app is very simple. I asynchronously load data from the server and then I render the component with the list of items fetched from the server. I have 4 states defined: IDLE, SUCCESS, ERROR and FETCHING. I basically copied the configuration from https://github.com/ericelliott/redux-dsm#usage-example. I use the reducer and action creators provided by the library (https://github.com/bognix/redux-dsm/blob/example-usage/examples/simpleFetch/dsm.js).
There is one part I feel uncomfortable with in my example:
When mapping state to props in redux connect I ended up with something that looks like a part of code that belongs to the reducer. However, because I use the reducer created by the library there is no obvious way (for me at least) to combine two reducers so they work on the same part of store. The reducer created by
redux-dsm
is responsible for assuring that actions are dispatched in proper order and update state only in such case. My reducer would be responsible for populating the state with correctly shaped data.I thought about it and for me it seems that the
redux-dsm
reducer responsibility could be replaced with a middleware. So theredux-dsm
library would return a middleware which when applied would assure that actions are dispatched in right order.Before I dig into the implementation I would like to know what you think about it and maybe how to solve the problem I mentioned with different means.
The text was updated successfully, but these errors were encountered: