Questions tagged [refluxjs]

A simple library for uni-directional dataflow application architecture inspired by ReactJS Flux

A simple library for uni-directional dataflow application architecture inspired by (available at https://github.com/reflux/refluxjs)

Similarities with Flux

Some concepts are still in Reflux in comparison with Flux:

  • There are actions
  • There are data stores
  • The data flow is unidirectional

Differences with Flux

Reflux has refactored Flux to be a bit more dynamic and be more Functional Reactive Programming (FRP) friendly:

  • The singleton dispatcher is removed in favor for letting every action act as dispatcher instead.
  • Because actions are listenable, the stores may listen to them. Stores don't need to have a big switch statements that does static type checking (of action types) with strings
  • Stores may listen to other stores, i.e. it is possible to create stores that can aggregate data further, similar to a map/reduce.
  • waitFor is replaced in favor to handle serial and parallel data flows:
    • Aggregate data stores (mentioned above) may listen to other stores in serial
    • Joins for joining listeners in parallel
  • Action creators are not needed because RefluxJS actions are functions that will pass on the payload they receive to anyone listening to them
191 questions
6
votes
2 answers

Where should be the line to separate stateful and stateless component in React?

React encourages the use of stateless components as much as possible and have a stateful parent component managing them. I understand that this can make the stateless components more reusable, and easy to manage. However, to the extreme, we can…
YiFeng
  • 961
  • 2
  • 7
  • 15
6
votes
1 answer

Reflux trigger won't work without a delay in init

I use Reflux, and normally I'm triggering after I made an ajax call, and it works well. For testing purposes I didn't need ajax call and I noticed that trigger won't work unless I give a min 5ms timeout. Here are working and not working example. Not…
Mïchael Makaröv
  • 1,085
  • 12
  • 21
5
votes
2 answers

ReactJS Reflux using mixins with ES6

How do you solve mixins with reflux using ES6? Like this: mixins: [Reflux.listenTo(myStore, "onChange")] ^ Results in error "Unexpected token" with arrow shown above. React v 0.14.7 Reflux v 0.4.0
Amidii
  • 335
  • 2
  • 17
5
votes
1 answer

Trigger Notification/Callback after reflux action execution

I recently used reflux in my project and here is a question puzzled me a lot. As the reflux pattern, I call actions in my React components, and fetch remote data in my reflux store which are listening to the actions. And my components listen to the…
Zhang Chao
  • 757
  • 4
  • 14
5
votes
2 answers

React/Reflux: Converting classes with mixins to ES6 using decorators

I'm trying to es6-ify the following React-Reflux code: var TimeStore = Reflux.createStore({ listenables: [TimeActions], onTick: function(tick) { .... } }) var Watch = React.createClass({ mixins:…
Jeanluca Scaljeri
  • 26,343
  • 56
  • 205
  • 333
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
1 answer

How to handle state transitions in a React / Flux component

Given I have an AJAX based search field that reacts on user input, requests search results from a backend via AJAX, shows the results in a dropdown below the search field, allows navigation through the search results via cursor keys and reacts on…
GeorgieF
  • 2,687
  • 5
  • 29
  • 43
4
votes
1 answer

Hook Reflux store in React.createClass and trigger actions the right way

I have made an attempt to hook the store into react component defined via React.createClass. I have achieved a global state but a lot of re-factoring needs to be done. I will share the relevant code and proceed with questions thereafter. Actions var…
HalfWebDev
  • 7,022
  • 12
  • 65
  • 103
4
votes
1 answer

Queuing asynchronous actions in reflux

When using RefluxJS stores with asynchronous actions, you can easily end up having race conditions between your actions. Abstract description of the issue For example, our store is in state X. An async action A is called from X, and before it…
Soreine
  • 121
  • 1
  • 5
4
votes
2 answers

How to troubleshoot es6 module dependencies?

I am developing a React & Reflux app, which is bundled by webpack with babel-loader (v6), and I am experiencing es6 modules dependencies issues For example, I have a component that use the reflux .connect() mixin : import MyStore from…
Pandaiolo
  • 11,165
  • 5
  • 38
  • 70
4
votes
2 answers

React Js, Reflux render before ajax response

I would like to get my users list with the api call and render a table with the data. At the moment I can get the data but wen I try to display it, I have an error. I think react is rendering before api call ends dont understand why. Here is my code…
slim_kh
  • 41
  • 2
4
votes
1 answer

How can I clear the state in React.js?

I think I may be missing something conceptually about how React and Reflux work. If I have set the state of an object ("project"), as it renders to the screen (with its existing properties), how can I then use that same state (and store) to create a…
D'Arcy Rail-Ip
  • 11,505
  • 11
  • 42
  • 67
4
votes
1 answer

Test state change of a reflux store with mocha

I am writing mocha tests against a Reflux store, to validate that an action causes the state within a store to change. The scaled-down version of the code is given below: Store: var AppStore = Reflux.createStore({ init: function () { this.foo…
aquaraga
  • 4,138
  • 23
  • 29
4
votes
2 answers

React Router with RefluxJS - Changing route Programmatically from a Store

In my project I deiced to include React Router. One of my Reflux Stores need to figure out the path based on some BL and than change it. First I've tried including the Navigation mixin inside the Store and running this.transitionTo("Foo"); which…
sergelerner
  • 499
  • 1
  • 4
  • 15
4
votes
1 answer

How to Make React.js component listen to a store in Reflux

I am building an app using React.js and Reflux and I am having trouble getting a component to listen to a store. First of all, I have successfully linked my store with an event, which looks like this: Component sends action to store: var CalcRow…
psvj
  • 8,280
  • 8
  • 30
  • 44
1
2
3
12 13