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

Passing CSRF token to REACT/FLUX from node

I'm using nodejs and usually pass down csrf token like the following: util.js module.exports.csrf = function csrf(req, res, next){ res.locals.token = req.csrfToken(); next(); }; app.js app.use(csrf()); app.use(util.csrf); and then in…
Saad
  • 26,316
  • 15
  • 48
  • 69
11
votes
2 answers

Dispatching further actions when handling actions

I have a scenario where I feel like I need to dispatch an action in response to another action, and I don't know the best way to sort it out. An action is dispatched in response to an HTTP response, something like: type: 'auth' data: { username:…
Tom
  • 1,043
  • 8
  • 16
11
votes
1 answer

flux multiple store instances

In a flux application where data is divided into buckets by owner id, should we use one store which internally separates the data into buckets, or one store instance per bucket? For instance, we have an application user who is a coach for multiple…
Micah Condon
  • 155
  • 1
  • 6
11
votes
3 answers

Asynchronous data loading in flux stores

Say I have a TodoStore. The TodoStore is responsible for keeping my TODO items. Todo items are stored in a database. I want to know what is the recommended way for loading all todo items into the store and how the views should interact with the…
rafalotufo
  • 3,862
  • 4
  • 25
  • 28
10
votes
1 answer

Update redux state with an input

How can I update redux's state from a text input? I'm trying to do a very simple "Hello World" with a text input. When someone types into the text input, it should update my store's "searchTerm" value. I can't figure out these things: 1. How can I…
Don P
  • 60,113
  • 114
  • 300
  • 432
10
votes
1 answer

Abstraction in React.js

I want to use some abstraction in the creation of my React components. For example: class AbstractButton extends React.Component { render() { return (
10
votes
4 answers

React.js - flux vs global event bus

What is the advantage of using Flux over a global event bus? I think the dispatcher is all that is needed: component publishes 'user event' with data to the dispatcher dispatcher executes handler of the subscribed store handler publishes 'update…
tldr
  • 11,924
  • 15
  • 75
  • 120
10
votes
3 answers

How to redirect after success from ajax call using React-router-component?

I am building a application using Facebook flux architecture of React JS. I have build the basic part of app where I have a login form. I am fetching the the result from node server to validate user at the store, I am getting the result from server,…
Toretto
  • 4,721
  • 5
  • 27
  • 46
10
votes
1 answer

EventEmitter vs facebook's dispatcher

I am using react with Flux architecture. I've read on the web that in order to define Store, I have to do something like that: var AppDispatcher = require('../dispatcher/dispatcher'), //facebook's dispatcher EventEmitter =…
Naor
  • 23,465
  • 48
  • 152
  • 268
10
votes
1 answer

React dispatcher WAITFOR

I'm trying to use the waitFor function of react.js but it seems I'm doing something wrong. What I want to do i basic, wait for a store to be filled before calling it from another store. 1.Register token in the first…
François Richard
  • 6,817
  • 10
  • 43
  • 78
10
votes
1 answer

React way to route without re-rendering

So I have a simple React/Flux app using Backbone's router. I have a case where the user creates an object, and the path updates from /object/new to /object/:id. However, there is no need to re-render the page, because the component is the same, and,…
mattmattmatt
  • 965
  • 3
  • 15
  • 29
9
votes
4 answers

Fetch api post call returning 403 forbidden error in React js but the same URL working in postman

Below code is not working and returning 403 forbidden but the same url giving the correct response postman tool. fetch('https://example.com/', { method: 'POST', headers: {'Content-Type': 'application/json', }, …
Manu Ram V
  • 369
  • 1
  • 3
  • 23
9
votes
6 answers

React Native Android: Static Image is not showing in production released apk

I have static image in my react-native app accessing via in development it is showing well but in production release APK is not showing what can be the reason? I have…
Waleed Arshad
  • 1,081
  • 3
  • 12
  • 24
9
votes
2 answers

Why should addChangeListener be in componentDidMount instead of componentWillMount?

I saw this line as an answer to another question on here: "componentWillMount should be componentDidMount, or else you'll leak event emitters in node." and I don't really understand it. Can someone explain with more detail? More info: Building a…
hmlee
  • 877
  • 1
  • 9
  • 22
9
votes
2 answers

Cannot read property '__reactAutoBindMap' of undefined

For the last week now I've been completely at a loss for how to set up server side rendering with React. This is a new project but it's an express server and I'm attempting to render just a super simple hello world react app which uses…
imattacus
  • 354
  • 1
  • 3
  • 12