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
24
votes
2 answers

How to handle tree-shaped entities in Redux reducers?

I'm a bit stuck thinking on how to implement a reducer where its entities can have children of the same type. Let's take reddit comments as an example: each comment can have child comments that can have comments themselves etc. For simplification…
Vincent P
  • 699
  • 1
  • 7
  • 18
21
votes
5 answers

How to avoid dispatching in the middle of a dispatch

Within my Flux architected React application I am retrieving data from a store, and would like to create an action to request that information if it does not exist. However I am running into an error where the dispatcher is already dispatching. My…
Ian Walker-Sperber
  • 3,661
  • 2
  • 14
  • 18
21
votes
3 answers

Emitting and handling global events with react

I'm playing around a bit with react to build an "Add to cart button". Here's my code. var ProductPurchase = React.createClass({ handleSubmit: function(e){ e.preventDefault(); $.ajax({ url: "/cart/add.js", method: "post", …
ThomasReggi
  • 55,053
  • 85
  • 237
  • 424
21
votes
4 answers

Flux Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch

My code https://gist.github.com/ButuzGOL/707d1605f63eef55e4af So when I get sign-in success callback I want to make redirect, redirect works through dispatcher too. And I am getting Dispatch.dispatch(...): Cannot dispatch in the middle of a…
ButuzGOL
  • 1,233
  • 2
  • 13
  • 27
19
votes
2 answers

Redux state persistence with a database

From the discussion here it seems that the state of Redux reducers should be persisted in a database. How does something like user authentication works in this instance? Wouldn't a new state object be created to replace the previous state in the…
hoodsy
  • 894
  • 2
  • 11
  • 19
19
votes
2 answers

React, Flux, State and Stores

I find the example todo flux app to be a bit lacking so I'm trying to get my head round things by developing an application to learn and experiment. The application is a drag and drop fruit basket organiser. I have several baskets which can have…
user3687035
  • 193
  • 1
  • 1
  • 6
17
votes
2 answers

Is it a good design, when a React Flux store emits multiple kinds of events?

Almost all tutorials I found about flux emits only one event per store (emitChange). I don't really know, that it is intentional, or just the consequence of the tutorials simplicity. I try to implement a store, that corresponds to the CRUD…
gsanta
  • 754
  • 6
  • 21
17
votes
3 answers

Handling a timer in React/Flux

I'm working on an application where I want a timer to countdown from, say, 60 seconds to 0 and then change some content, after which the timer restarts again at 60. I have implemented this in React and Flux but since I'm new to this, I'm still…
Joris Ooms
  • 11,880
  • 17
  • 67
  • 124
16
votes
3 answers

Where to put API calls in React/Redux architecture?

I am trying to retrieve some data from an API and pass it into my application. Being new to React/Redux however, I am wondering where to make these calls from and how to pass it into my application? I have the standard folder structure (components,…
Peter Zacharias
  • 795
  • 4
  • 13
  • 24
16
votes
3 answers

is there any good Http library for React flux architecture

We have a react application with Flux architecture, I am searching any good library for sending http request like angular's $http, $resources.
Vinoth Rajendran
  • 1,181
  • 1
  • 13
  • 28
16
votes
6 answers

How to create API calls in REACT and FLUX

I'm new to react and flux and I am having a hard time trying to figure out how to load data from a server. I am able to load the same data from a local file with no issues. So first up I have this controller view (controller-view.js) that passes…
Jose the hose
  • 1,805
  • 9
  • 33
  • 56
16
votes
1 answer

Error Handler with Flux

I have a React.js application that I am refactoring to use the Flux architecture, and am struggling to figure out how error handling should work while sticking to the Flux pattern. Currently when errors are encountered, a jQuery event 'AppError' is…
beerdev
  • 451
  • 5
  • 14
15
votes
1 answer

Why do Flux architecture examples use constants for action types instead of strings?

Throughout the examples and explanations of Flux architecture -- Facebook's counterpart to React -- action type names are referenced as enum constants rather than strings. (See examples at http://facebook.github.io/flux/) I am just looking for an…
davidtheclark
  • 4,666
  • 6
  • 32
  • 42
14
votes
2 answers

How to do POST in FORM Submit using reactjs and pass the object value into REST service?

I have created a login page using reactjs, when I send my user input/password through a post method rest api call to authenticate I am receiving an error. Can somebody help me on whats going wrong here please!! I guess this is because I am unable to…
user4398985
14
votes
2 answers

Is it OK to call setState from within shouldComponentUpdate?

In response to a state change, I want to trigger another state change. Is that inherently a bad idea? The specific sort of scenario is that the component is modeled as a state machine that renders different information according to the value of…
osdiab
  • 1,972
  • 3
  • 26
  • 37
1 2
3
54 55