{"componentChunkName":"component---src-templates-blog-js","path":"/blog/2014/05/06/flux.html","result":{"data":{"markdownRemark":{"html":"<p>We recently spoke at one of f8’s breakout session about Flux, a data flow architecture that works well with React.  Check out the video here:</p>\n<div class=\"gatsby-resp-iframe-wrapper\" style=\"padding-bottom: 48.46153846153846%; position: relative; height: 0; overflow: hidden; \" > <figure><iframe src=\"//www.youtube-nocookie.com/embed/nYkdrAPrdcw?list=PLb0IAmt7-GS188xDYE-u1ShQmFFGbrk0v&amp;start=621\" frameborder=\"0\" allowfullscreen style=\" position: absolute; top: 0; left: 0; width: 100%; height: 100%; \"></iframe></figure> </div>\n<p>To summarize, Flux works well for us because the single directional data flow makes it easy to understand and modify an application as it becomes more complicated. We found that two-way data bindings lead to cascading updates, where changing one data model led to another data model updating, making it very difficult to predict what would change as the result of a single user interaction.</p>\n<p>In Flux, the Dispatcher is a singleton that directs the flow of data and ensures that updates do not cascade. As an application grows, the Dispatcher becomes more vital, as it can also manage dependencies between stores by invoking the registered callbacks in a specific order.</p>\n<p>When a user interacts with a React view, the view sends an action (usually represented as a JavaScript object with some fields) through the dispatcher, which notifies the various stores that hold the application’s data and business logic. When the stores change state, they notify the views that something has updated. This works especially well with React’s declarative model, which allows the stores to send updates without specifying how to transition views between states.</p>\n<p>Flux is more of a pattern than a formal framework, so you can start using Flux immediately without a lot of new code. An <a href=\"https://github.com/facebook/flux/tree/master/examples/flux-todomvc\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">example of this architecture</a> is available, along with more <a href=\"https://facebook.github.io/flux/docs/overview.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">detailed documentation</a> and a <a href=\"https://facebook.github.io/flux/docs/todo-list.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">tutorial</a>. Look for more examples to come in the future.</p>","excerpt":"We recently spoke at one of f8’s breakout session about Flux, a data flow architecture that works well with React.  Check out the video here: To summarize, Flux works well for us because the single directional data flow makes it easy to understand and modify an application as it becomes more complicated. We found that two-way data bindings lead to cascading updates, where changing one data model led to another data model updating, making it very difficult to predict what would change as the…","frontmatter":{"title":"Flux: An Application Architecture for React","next":null,"prev":null,"author":[{"frontmatter":{"name":"Bill Fisher","url":"https://twitter.com/fisherwebdev"}},{"frontmatter":{"name":"Jing Chen","url":"https://twitter.com/jingc"}}]},"fields":{"date":"May 06, 2014","path":"content/blog/2014-05-06-flux.md","slug":"/blog/2014/05/06/flux.html"}},"allMarkdownRemark":{"edges":[{"node":{"frontmatter":{"title":"Introducing the New JSX Transform"},"fields":{"slug":"/blog/2020/09/22/introducing-the-new-jsx-transform.html"}}},{"node":{"frontmatter":{"title":"React v17.0 Release Candidate: No New Features"},"fields":{"slug":"/blog/2020/08/10/react-v17-rc.html"}}},{"node":{"frontmatter":{"title":"React v16.13.0"},"fields":{"slug":"/blog/2020/02/26/react-v16.13.0.html"}}},{"node":{"frontmatter":{"title":"Building Great User Experiences with Concurrent Mode and Suspense"},"fields":{"slug":"/blog/2019/11/06/building-great-user-experiences-with-concurrent-mode-and-suspense.html"}}},{"node":{"frontmatter":{"title":"Preparing for the Future with React Prereleases"},"fields":{"slug":"/blog/2019/10/22/react-release-channels.html"}}},{"node":{"frontmatter":{"title":"Introducing the New React DevTools"},"fields":{"slug":"/blog/2019/08/15/new-react-devtools.html"}}},{"node":{"frontmatter":{"title":"React v16.9.0 and the Roadmap Update"},"fields":{"slug":"/blog/2019/08/08/react-v16.9.0.html"}}},{"node":{"frontmatter":{"title":"Is React Translated Yet? ¡Sí! Sim! はい！"},"fields":{"slug":"/blog/2019/02/23/is-react-translated-yet.html"}}},{"node":{"frontmatter":{"title":"React v16.8: The One With Hooks"},"fields":{"slug":"/blog/2019/02/06/react-v16.8.0.html"}}},{"node":{"frontmatter":{"title":"React v16.7: No, This Is Not the One With Hooks"},"fields":{"slug":"/blog/2018/12/19/react-v-16-7.html"}}}]}},"pageContext":{"slug":"/blog/2014/05/06/flux.html"}},"staticQueryHashes":[]}