L
L
LB7772015-05-13 17:43:23
flux
LB777, 2015-05-13 17:43:23

How to properly structure ajax requests in flux?

In simple examples made on react.js, I saw that the call to the server was in a view that was re-rendered when a response was received from the server.
But storing data in a view is somehow not right, especially when using Flux.
In my opinion, it is correct after the event (for example, clicking on the "get data" button), to deal with their services that will contact the server, having received a response from the server, they must use certain actions that will transfer data to the storage, and already it will pass them to the view, which will be re-rendered.
But I have not seen such examples, so the question is:
How to properly organize interaction with the server in terms of application architecture?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
liubko, 2015-05-15
@liubko

1. component pulls action
2. action makes ajax request, after completion dispatch
3. store receives data and notifies about change
4. re-render
here is more code: What to choose for SPA?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question