Questions tagged [flux]

An application design paradigm used as a replacement for MVC, pioneered at Facebook by Jing Chen

Flux is an application design paradigm used as a replacement for the more traditional pattern.

It complements React's composable view components by utilizing a unidirectional data flow. It's more of a pattern rather than a formal framework, and you can start using Flux immediately without a lot of new code.


Popular implementations :

1455 questions
1124
votes
8 answers

Why use Redux over Facebook Flux?

I've read this answer, reducing boilerplate, looked at few GitHub examples and even tried redux a little bit (todo apps). As I understand, official redux doc motivations provide pros comparing to traditional MVC architectures. BUT it doesn't…
VB_
  • 43,322
  • 32
  • 111
  • 238
247
votes
7 answers

What could be the downsides of using Redux instead of Flux

I just recently discovered Redux. It all looks good. Are there any downsides, gotcha or compromises of using Redux over Flux? Thanks
Ivan Wang
  • 7,706
  • 12
  • 40
  • 51
193
votes
6 answers

How to dynamically load reducers for code splitting in a Redux application?

I'm going migrate to Redux. My application consists of a lot of parts (pages, components) so I want to create many reducers. Redux examples show that I should use combineReducers() to generate one reducer. Also as I understand Redux application…
Pavel Teterin
  • 1,961
  • 3
  • 11
  • 9
119
votes
4 answers

How to store Configuration file and read it using React

I am new on react.js I have implemented one component in which I am fetching the data from server and use it like, CallEnterprise:function(TenantId){ fetchData('http://xxx.xxx.xx.xx:8090/Enterprises?TenantId='+TenantId+'…
Dhaval Patel
  • 7,053
  • 6
  • 34
  • 64
116
votes
1 answer

Should you ever use this.setState() when using redux?

Should you ever use this.setState() when using redux? Or should you always be dispatching actions and relying on props?
Martol1ni
  • 4,616
  • 2
  • 27
  • 38
114
votes
6 answers

Strategies for server-side rendering of asynchronously initialized React.js components

One of the biggest advantages of React.js is supposed to be server-side rendering. The problem is that the key function React.renderComponentToString() is synchronous which makes it impossible to load any asynchronous data as the component hierarchy…
tobik
  • 6,558
  • 7
  • 38
  • 49
112
votes
5 answers

Pretty Printing JSON with React

I'm using ReactJS and part of my app requires pretty printed JSON. I get some JSON like: { "foo": 1, "bar": 2 }, and if I run that through JSON.stringify(obj, null, 4) in the browser console, it pretty prints, but when I use it in this react…
Brandon
  • 2,563
  • 6
  • 16
  • 21
101
votes
3 answers

How can I persist redux state tree on refresh?

The first principal of Redux documentation is: The state of your whole application is stored in an object tree within a single store. And I actually thought that I understand all of principals well. But I'm now confused what does application…
incleaf
  • 1,505
  • 3
  • 13
  • 11
78
votes
8 answers

how to cancel/abort ajax request in axios

I use axios for ajax requests and reactJS + flux for render UI. In my app there is third side timeline (reactJS component). Timeline can be managed by mouse's scroll. App sends ajax request for the actual data after any scroll event. Problem that…
Rajab Shakirov
  • 4,477
  • 6
  • 22
  • 40
57
votes
6 answers

How to download fetch response in react as file

Here is the code in actions.js export function exportRecordToExcel(record) { return ({fetch}) => ({ type: EXPORT_RECORD_TO_EXCEL, payload: { promise: fetch('/records/export', { credentials:…
Rafael K.
  • 1,779
  • 2
  • 14
  • 29
50
votes
3 answers

How to put methods onto the objects in Redux state?

According to docs state of react app has to be something serializable. What about classes then? Let's say I have a ToDo app. Each of Todo items has properties like name, date etc. so far so good. Now I want to have methods on objects which are non…
Yan
  • 890
  • 1
  • 7
  • 12
49
votes
4 answers

MVC vs. Flux ? Bidirectional vs. Unidirectional?

Looking at the following diagram (which explains MVC), I see unidirectional data flow. So why do we consider MVC to have bidirectional data flow while justifying Flux ?
Arian
  • 6,016
  • 14
  • 70
  • 144
47
votes
2 answers

How to handle complex side-effects in Redux?

I've been struggling for hours to finding a solution to this problem... I am developing a game with an online scoreboard. The player can log in and log out at any time. After finishing a game, the player will see the scoreboard, and see their own…
Thai
  • 9,372
  • 1
  • 35
  • 47
43
votes
4 answers

React + Flux and Server-side rendering? (Isomorphic React + Flux)

What is the general practice of setting the initial state of the app with isomorphic applications? Without Flux I would simple use something like: var props = { }; // initial state var html = React.renderToString(MyComponent(props); Then render…
Sahat Yalkabov
  • 29,198
  • 40
  • 103
  • 171
38
votes
2 answers

What is the core difference of redux & reflux in using react based application?

Recently I conducted a preliminary study on developing an E-commerce site and discovered that redux and reflux both come from flux architecture in Facebook and that both are popular. I am confused about the difference between the two. When should I…
Zahid Rahman
  • 1,471
  • 1
  • 15
  • 25
1
2 3
96 97