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
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…
Zahidur Rahman
  • 1,688
  • 2
  • 20
  • 30
30
votes
1 answer

How does react-router pass params to other components via props?

Thus far, the extent of my knowledge about how properties are passed from one component to another via parameters is as follows //start: extent of my knowledge Suppose there exists some state variable called topic in A.jsx. I want to pass this down…
thetrystero
  • 5,622
  • 5
  • 23
  • 34
25
votes
4 answers

React + Flux - should store data be stored in a component state, or props?

If that the flux store is a singleton that maintains the state of the data why do the components use setState and not setProps when accessing the stores? Wouldn't it just mean that I started saving the application state in two (or more) places? Both…
Guy Nesher
  • 1,385
  • 2
  • 14
  • 26
23
votes
3 answers

Where to put business logic in redux? action or store

i come from Reflux to Redux. in Reflux your business logic is exist only in store but in Redux its seems different..for example in "Redux" i have "async-action" and i implemented it with "redux-thunk" . in one scenario i want to check something in…
hossein derakhshan
  • 771
  • 2
  • 10
  • 23
13
votes
3 answers

React + Flux: Getting initial state into a store

We have recently switched over to React + Flux from Angular to build a rather complex business application. Taking the approach of having one container component that passes all state as properties down the component tree isn't a practical way to…
Markus Coetzee
  • 3,384
  • 1
  • 29
  • 26
13
votes
2 answers

How to mock specific function in object using Jest?

I'm testing a React/Reflux application using Jest. I have the following function in a store: onLoad: function() { console.log("ORIGINAL LOAD"); // http request here } I'm trying to mock it out so that it just does what it needs to do without…
Hugo
  • 2,186
  • 8
  • 28
  • 44
12
votes
2 answers

Why do we need Flux with React?

I don't understand why we need Flux with React as React itself let's us maintain the state of the application. Every component has an initial state and the state can be changed by user actions or any other asynchronous JavaScript. Why is React…
Narayan Prusty
  • 2,501
  • 3
  • 22
  • 41
12
votes
1 answer

How to deal with hierarchical data with Reflux stores?

Outline In my app I'm using React and Reflux and have a hierarchical setup with regards to my data. I'm trying to break elements of my app into separate stores to be able to hook events correctly and separate concerns. I have the following data…
9
votes
6 answers

How to detect child renders in a parent component in react.js

I'm trying to cache the rendered markup of the App component. I know that this is somehow "against the rules" but I'm in a server-less environment (chrome-extension). Upon page load i want to inject the cached App markup into the DOM. The expected…
derflocki
  • 863
  • 1
  • 11
  • 19
9
votes
3 answers

Reflux how to listen for async action completed

From reading the docs I don't quite understand how Reflux async actions work. In particular I need to trigger something when an async action completes. In one of my components I want to listen for an async action complete and then transition to a…
Thijs Koerselman
  • 21,680
  • 22
  • 74
  • 108
8
votes
2 answers

Proper way to initialize data

What is the proper way to initialize data (asynchronously) with RefluxJS? Is there something similar to AngularJS' resolves, or the Flux implementation has nothing to do with this (The router should be handling this reponsibility)?
srph
  • 1,312
  • 17
  • 35
7
votes
2 answers

React: Rendering a list in reverse order

I'm building an app with React and Reflux, and I am trying to render a list of items in a specific order. The items are custom Post components that are rendered in reverse chronological order, so the newest post is at the top of the list. I am…
7
votes
4 answers

Refreshing children state from parent React

I have a table with some data and each element in the table is a React class component. It looks like this: All i want is to have one checkbox for "check all" feature (top left checkbox). The thing is I don't know how to solve that because of props…
Tomasz Kasperek
  • 1,147
  • 3
  • 13
  • 35
6
votes
5 answers

How to fast render >10000 items using React + Flux?

I would like to ask what is the correct way to fast render > 10000 items in React. Suppose I want to make a checkboxList which contain over dynamic 10000 checkbox items. I make a store which contain all the items and it will be used as state of…
RaymondFakeC
  • 75
  • 1
  • 7
6
votes
2 answers

Endless loop rendering component on ReactJs

I'm facing an infinite loop issue and I can't see what is triggering it. It seems to happen while rendering the components. I have three components, organised like this : TimelineComponent |--PostComponent …
Yonirt
  • 165
  • 2
  • 2
  • 11
1
2 3
12 13