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
1
vote
1 answer

Import default with alias

I would like to import a default exported store with an alias using the syntax import XXX as A from YYY. I know it works with this set up: class XXX extends Reflux.Store{...} export XXX; //In another class you import: import {XXX as ABC} from…
Chayemor
  • 3,577
  • 4
  • 31
  • 54
1
vote
1 answer

When to use Dispatcher in React Application

I am facing some issue while using Dispatcher in ReactJS. So, I try to remove this dispatcher from the store and still store works well. Store properly hold my data and change event works well. Now I am bit confusing to use dispatcher in our…
Kushal Jain
  • 3,029
  • 5
  • 31
  • 48
1
vote
0 answers

Reflux actions that commit multiple local changes to a remote source

What's a sustainable, consistent and logical way to deal with Reflux actions that commit a number changes that have only been made locally to a remote source? The unidirectional dataflow makes perfect sense if user interaction always (or never, as…
Hannes Petri
  • 864
  • 1
  • 7
  • 15
1
vote
0 answers

How to Provide Global Types for External Module without @Types Definitions?

Using TS 2.3.2 the types format has changed so installing types requires non-global typings or NPM @types for global types. This is all well and good except when global types are required and there are no NPM @types definitions - the error produced…
Kallum Tanton
  • 802
  • 7
  • 22
1
vote
0 answers

Reflux.utils.environment is undefined. Why?

I have the next code and I don't understand why it doesn't work now. The next code inits Reflux that I use in my project: module.exports = { configure: function () { var Reflux = require('reflux'); …
yurart
  • 593
  • 1
  • 6
  • 23
1
vote
1 answer

reactjs reflux handle login

I'm new to ReactJS and I followed this tutorial: http://adamalbrecht.com/2015/07/20/authentication-using-json-web-tokens-using-rails-and-react/ After I make some corrections to the code to get it working on my setup, I can successfully login. But…
Evolutio
  • 976
  • 17
  • 37
1
vote
2 answers

What is the difference between seeding a action and call a 'setter' method of a store in reflux data flow?

What is the difference between seeding a action and call a 'setter' method of a store in reflux data flow? TodoActions['add'](todo) vs TodoStore.add(todo)
JunGor
  • 423
  • 4
  • 10
1
vote
0 answers

Mocking Reflux.js store during React component shallow rendering in test with enzyme

I'm writing React application. I want to test in isolation component that is wired up with Reflux.js store with: mixins: [ Reflux.connect(CountriesStore) ], Initialization code of CountresStore calls action that tries to fetch list of…
zmii
  • 4,123
  • 3
  • 40
  • 64
1
vote
2 answers

Redux use token in every API request

I am trying to develop an app using React Native, Redux and Redux Saga. I have the following login flow: Login Form Login Attempt Action Login Saga API Call Login Reducer stores auth token I have multiple containers and components which each…
Lee
  • 5,816
  • 6
  • 45
  • 61
1
vote
1 answer

Uncaught Error : Action is missing a listen method React/Reflux?

I am New to React Redux.This is a simple App I am developing.But Error is I can't connect to store through Action. This is my error utils.js:78 Uncaught Error: action is missing a listen method topic-list.js var React = require('react'); var…
Bajwa kapoor
  • 73
  • 3
  • 12
1
vote
1 answer

creating "gated" react components

so I have an app that is using Reflux router and I want to create admin only areas in the app. what I'm trying to achieve is when a user goes to a gated part of the app that part of the app will make an API call to check of the user is authorized to…
zero
  • 2,999
  • 9
  • 42
  • 67
1
vote
0 answers

Init function isn't calling when Reflux.createStore

I have mocked store var action = Reflux.createAction('action'); var mockFn = jest.genMockFn(); var store = Reflux.createStore({ init: function () { console.log("INIT MOCK"); this.listenTo(action, this.onAction); }, …
Gleb
  • 1,312
  • 3
  • 18
  • 36
1
vote
0 answers

localhost:8080 stopping my reply from API

I am doing a tutorial on React with Reflux. But Im getting a 404 on the query response. I think it has todo with the url sent to fetch the data. When I do a console.log on the variable 'url' I get the…
morne
  • 4,035
  • 9
  • 50
  • 96
1
vote
0 answers

why in react flux: component this.state is updated automatically when store changed?

I am confused why in component as bellows, this.state is automatically changed when corresponding store updated? The compoenent is listening to MyStore. Once the number there changed, it will call onchange() in the component, which is supposed to…
Ying
  • 11
  • 2
1
vote
1 answer

Reflux state update not showing change of defaultValue of textarea?

I'm using Reflux for a forum, and I'm trying to make it so the user can select a category to write in and then fill out a template. For this, I have a setCategory function for onChange for the dropdown menu, which sets the state and therefore…
nasonfish
  • 455
  • 1
  • 4
  • 14