Comments (4)
Maybe what you're looking for is that kind of pattern https://github.com/didierfranc/react-waterfall/blob/master/examples/fetch/src/store/index.js#L13-L22
from react-waterfall.
Well, not exactly. Actually, I am try to find a way to set state multiple times inside an action, and each setState should trigger the ui updates. Though this could be done via calling other actions, still wondering more straight forward way to trigger state change instead of return only one state.
from react-waterfall.
You can't do that with redux, same here (action, state) => state
but you can chain actions
from react-waterfall.
Something like this:
export function getEventList(filterText) {
return async (dispatch, getState) => {
try {
const state = getState();
const accountId = getActiveAccountId(state);
dispatch({ type: GET_EVENT_LIST_LOADING, payload: { accountId } });
const {
eventList,
events,
timestamp,
} = await api.getEventList(filterText);
dispatch({ type: GET_EVENTS_COMPLETE, payload: eventsPayload });
dispatch({ type: GET_EVENT_LIST_COMPLETE, payload: eventListPayload });
} catch (err) {
dispatch({ type: GET_EVENT_LIST_ERROR, payload: err });
}
};
}
Each dispatch() will trigger state change, and state changed multiple times within an action
from react-waterfall.
Related Issues (20)
- can not use Next.js getInitialProps() with react-waterfall connect(). HOT 2
- Unable to run tests
- Why was the reselect example removed? HOT 1
- Question: Middleware possibilites HOT 3
- Question: why is this clone of Redux better than Redux? HOT 1
- typescript type support HOT 13
- reset/clear state for SSR? HOT 5
- Whatever happened to getState? HOT 3
- v4 examples are broken because the actions argument is missing HOT 3
- Action not receiving value HOT 2
- Chaining actions and waiting for state updates? HOT 1
- Plans and roadmap? HOT 2
- The future of react-waterfall HOT 6
- Redux Dev Tools upgrade needed HOT 2
- error when running react-waterfall-example https://github.com/didierfranc/react-waterfall-example/ HOT 1
- Uncaught TypeError: A class descriptor's .kind property must be "class", but a decorator created a class descriptor with .kind "undefined" HOT 1
- Router: Store returns to initialState on loading different page HOT 2
- Multiple Contexts supported? HOT 3
- Only re-render if action creator returns an object HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-waterfall.