Comments (2)
I assume you're using React Router? Have you checked out the async-data example? https://github.com/rackt/react-router/blob/master/examples/async-data/app.js
In that example, the static method fetchData()
returns a promise for data to be added to the topmost handler as props. With Flux, I've been using a modified version of this, where you return a promise that resolves after any async actions have completed. That way you can do whatever async operations you need to do to prepare your stores. Here's a simple example: https://github.com/acdlite/flummox-isomorphic-demo/blob/master/src/shared/components/StargazerGridHandler.js#L14-L18
This pattern is pretty useful, so I wrote a helper: https://github.com/acdlite/flummox-isomorphic-demo/blob/master/src/shared/performRouteHandlerStaticMethod.js
For complex dependencies like the one you described, you just have to make sure you chain your async operations together using either then()
or async-await.
Server-side data fetching is the least developed part of Flux in my opinion, which is why I'm so pumped for Relay.
from flummox.
Yeah that's the current setup I have also. React router + static route handler like in your example. The problem I had was making one route handler wait on another when you have sub-routes. Anyway I have an idea that I might try.
Yeah Relay looks awesome and makes more sense then Flux for fetching data that doesn't change much over time. I'm also excited about it but the problem will be implementing it with current "legacy" backends.
from flummox.
Related Issues (20)
- how to get a child component input value HOT 1
- Missing getActionsAsObject from Actions HOT 5
- Incorrect params passed to async begin handler HOT 1
- More topic guides needed in doc HOT 1
- Context differs problem
- Do not pass flux prop to components wrapped with `connect` HOT 6
- Use Redux HOT 6
- Explanation in README as to why a switch to Redux should be made HOT 5
- Import flummox/component fails with 4.0.0-rc1 HOT 1
- unable to make flummox work with react-router 1.0.0-beta3 HOT 2
- Actions.js grabs all console logs HOT 4
- Wrong link in why-flux-component-is-better-than-flux-mixin.md
- Considering the numbers HOT 1
- Support for React 0.14 HOT 17
- How to only use custom stateGetter for subset of subscribed stores HOT 1
- Maintain module? HOT 4
- FluxComponent does not work on IE10 HOT 24
- Flummox 3.6 is incompatible with IE8 HOT 3
- TestUtils removed from NPM HOT 2
- Deprecation warning with React 15.5 HOT 1
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 flummox.