I'm studying Flux and I think I understood the workflow:
View -> Action -> Dispatcher -> Store -> View
However, I didn't quite understand where am I supposed to populate the initial state of my Stores.
For instance, let's say that I'm editing a Contact. So I'd assume I'd have a ContactsStore
. This is what I imagine would happen when I access the URL /contacts/edit/23
:
- Somehow my
ContactsStore
gets populated with the contact I'm editing, in this case, contact 23. The data would come from the server. - The
EditContact
view would receive a notification from theContactsStore
, so it would render itself in the initial state. - As I save the contact, the view would trigger the
SaveContact
action and the flow would go on.
Step (1) is not clear to me. Where is the ContactsStore
expected to be populated with the initial state? Where do I call the server? Is it on the Store?
Thanks.