I'm using React for a web application, and I've started learning about Flux. I like the concept of a unidirectional data flow, but I'm having some problems understanding how that connects to an API.
I have a back end written in Sinatra. What I'm confused about is how does the data flow from an interaction with the component to the back end and back again? Is it that the database and what Flux calls a Store are two different things?
The way I'm interpreting it is like this:
User interacts with React View =>
Action Creator sends data to back end =>
back end responds to Action Creator with new data/success/error =>
Action Creator sends action and response to Dispatcher =>
the Dispatcher sees the action and calls the callback based on that Action, passing it the back end response =>
the Store updates itself using the back end response =>
the Store sends the change event and the data to the React View =>
the React View renders =>
(cycle repeats)
What confuses me is how the stores work. Do I need two stores like how I'm interpreting it? Or is the back end supposed to be the store?