In a Flux app, what's the right way handle API requests other than the initial data load? -


when using flux, what's right way handle ajax requests other initial data load?

i'm building basic twitter-clone; have api utility loads initial data , calls action (tweetactions.loadtweets(data)), tweetstore listening for.

but what's pattern for, say, when user creates new tweet? right now, have react view class calling action (tweetactions.tweet(data)), , api utility listening action. utility makes api request, , when tweet saved server, calls action (tweetactions.savedtweet(data)). tweetstore listens that, , adds store, emits change event, , ui updated.

is there better this? haven't seen examples api utility registers function dispatcher, i'm not sure how else this.

what mean statement?

and api utility listening action

get flux diagram , follow arrows. web api utils should not talking dispatcher should invoked actions. when requests finished, need invoke action let's rest of system know request successful or failed.

http://i.imgur.com/vrkmrgq.png


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -