Questions tagged [reactjs-flux]

Flux is the application architecture that Facebook uses for building client-side web applications with React. It complements React's composable view components by utilizing a unidirectional data flow.

Flux is the application architecture that Facebook uses for building client-side web applications with React. It complements React's composable view components by utilizing a unidirectional data flow.

Flux applications have three major parts: the dispatcher(s), the store(s), and the view(s) (React components).

Flux eschews MVC in favor of a unidirectional data flow. When a user interacts with a React view, the view propagates an action through a central dispatcher, to the various stores that hold the application's data and business logic, which updates all of the views that are affected. This works especially well with React's declarative programming style, which allows the store to send updates without specifying how to transition views between states.

###Some popular implementations of Flux


Related tags

822 questions
5
votes
2 answers

React: input validation

I recently started working with React and I faced the problem with inputs validation. For example, it simply implemented in another framework as Angular.js via directives. After some researching I found newforms library, looks like the best…
Vladyslav Babenko
  • 1,349
  • 18
  • 26
5
votes
1 answer

How to communicate an action to a React component

While my scenario is pretty specific, I think it speaks to a bigger question in Flux. Components should be simple renderings of data from a store, but what if your component renders a third-party component which is stateful? How does one interact…
Jeff Fairley
  • 8,071
  • 7
  • 46
  • 55
5
votes
4 answers

On React Flux, where I am supposed to populate the initial state of my Stores?

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…
Andre Pena
  • 56,650
  • 48
  • 196
  • 243
5
votes
2 answers

Using Flux to build an edit form, who actually POSTs data to the server: actions, stores, views?

I have found a lot of resources, blogs, and opinions on how to fetch data for React and Flux, but much less on writing data to the server. Can someone please provide a rationale and some sample code for the "preferred" approach, in the context of…
Scott Stafford
  • 43,764
  • 28
  • 129
  • 177
5
votes
1 answer

Questions on State vs. Flux Stores for multi-feature application

I have been learning a lot about flux + react preparing for the upcoming project that will use React + Flux (alt implementation). While all the concepts are all clear to me regarding the flux architecture and how they are all connected together. I…
AbSoLution8
  • 1,203
  • 1
  • 18
  • 27
5
votes
2 answers

Flux threw Dispatcher is not a constructor

I try to use jspm with reactjs. I worked fine. But when I integrated it with flux package from npm. Then it always threw Dispatcher is not a constructor error. My code as below AppDispatcher.js import Flux from 'flux'; export default new…
thangchung
  • 2,020
  • 2
  • 17
  • 28
5
votes
1 answer

Flux: How to make an action wait for a store?

I'm tying myself in knots with a React problem which I'm sure can't be as difficult as it seems to me right now. I'm building a single page app against a RESTful server API that returns resources, together with links that describe what can be done…
kevinrutherford
  • 448
  • 3
  • 8
5
votes
4 answers

Isomorphic React + Flux + REST API

So, I've been fiddle:ing with some isomorphic React + Flux lately and have found some concepts quite confusing to be honest. I've been looking into best practices about how to structure isomorphic apps and are looking for advice. Suppose you are…
5
votes
1 answer

Where to fetch initial state when using flummox (flux)?

I'm trying to figure out where to load initial state, when using flummox, a flux library. I've see it done a few ways, but I'm curious if there's a recommended way to do it. Lets say you've got some todo items that you've saved in local storage or a…
Ryan
  • 7,733
  • 10
  • 61
  • 106
5
votes
3 answers

How do I update an array for a React component?

I have found that React does not update a component when an element in the array is changed. Instead, a new array must be cloned and put in its place. For example, I have an array of _suggestedPeople. When the UI element representing one of these…
Matt Norris
  • 8,596
  • 14
  • 59
  • 90
5
votes
3 answers

Should view call the store directly?

From the Flux's TodoMVC example, I saw the TodoApp component is asking the store to get the states. Should the view create the action and let the dispatcher to call the store instead?
Franz Wong
  • 1,024
  • 1
  • 10
  • 32
5
votes
1 answer

Flux + React.js - Callback in actions is good or bad?

Let me explain the problem that I've faced recently. I have React.js + Flux powered application: There is a list view of articles (NOTE: there are multiple of of different lists in the app) and article details view inside it. But there is only…
Kosmetika
  • 20,774
  • 37
  • 108
  • 172
5
votes
2 answers

react/flux- child component user events - should everything be routed via the dispatcher

I am just working on a simple prototype using flux and react. Previously when i have used React I have sent events from child components up to their parent components (who have registered prop callbacks on the child) and then changed state in the…
jonho
  • 1,680
  • 2
  • 19
  • 29
5
votes
1 answer

Can i pass data from node to react?

In node (using ejs) I can usually go: res.render('home', { data: someData }); is this still possible in react? I don't want to do client-side loading (via .ajax) for all my data, rather load some initial data and pass it to react (or flux).…
Saad
  • 26,316
  • 15
  • 48
  • 69
5
votes
3 answers

AJAX in Flux: Refreshing stores when dependent state changes

I'm building a Flux app using MartyJS (which is pretty close to "vanilla" Flux and uses the same underlying dispatcher). It contains stores with an inherent dependency relationship. For example, a UserStore tracks the current user, and an…
optilude
  • 3,538
  • 3
  • 22
  • 25