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
4
votes
0 answers

Facebook Flux: Store with multiple change events (or Flux without React)

In Flux pattern, is it ok for a store to declare multiple events for a view to listen to? E.g. listChanged, selectedListItemChanged, etc. At first glance it seems legit to me (either this or passing additional parameter in a change event) as it…
Dmitry Golubets
  • 570
  • 5
  • 13
4
votes
1 answer

Tracking ajax request status in a Flux application

We're refactoring a large Backbone application to use Flux to help solve some tight coupling and event / data flow issues. However, we haven't yet figured out how to handle cases where we need to know the status of a specific ajax request When a…
Micah Condon
  • 155
  • 1
  • 6
4
votes
1 answer

How do I use Jest to test a React view wired to store?

I have a React view that communicates with a store. I've successfully tested views and stores separately, but not in combination. I followed the structure documented here but received a TypeError. It looks like Jest is trying to register the store…
Matt Norris
  • 8,596
  • 14
  • 59
  • 90
4
votes
1 answer

How do I stub/mock a dependency's method copied from "superclass" with sinon

I'm having problems testing a Store in flux, wanting to stub out the dispatcher. I've seen how it's done with jest, but I Want to achieve the same with sinon. Here's what I have Source lib/Dispatcher. Full code here var invariant =…
andersem
  • 724
  • 1
  • 8
  • 19
4
votes
1 answer

How to handle data changes in Flux/React?

So far I worked quite thoroughly through the two official Flux architecture examples (https://github.com/facebook/flux). However, I am really unsure of how you would accomplish a change of data after the initial data has been rendered. For instance,…
Leo Selig
  • 1,062
  • 1
  • 16
  • 30
4
votes
2 answers

React Flux: Store dependencies

so I have recently playing with React and the Flux architecture. Let's say there are 2 Stores A and B. A has a dependecy on B, because it needs some value from B. So everytime the dispatcher dispatches an action, first B.MethodOfB gets executed,…
Tim Joseph
  • 847
  • 2
  • 14
  • 28
3
votes
2 answers

React.js: Why delete button is not working?

I am working on a blog frontpage where I would like to remove a particular post by pressing a delete button through simple setState command. my Blog.js is Below: import React from "react"; const BlogBody = props => { return props.postData.map(post…
ali
  • 135
  • 1
  • 13
3
votes
1 answer

React-countdown-now not updating on render

I am creating a Mission Clock web app using React and Flux. The code can be found here: https://github.com/jcadam14/Flux-Mission-Clock Right now it's extremely basic, I'm new to React and Flux and it has been an extremely long time since I did any…
Cthulhujr
  • 359
  • 3
  • 12
3
votes
2 answers

How to pass props to Actions.replace react-native-router-flux

Version Tell us which versions you are using: react-native-router-flux v4.0.0-beta.28 react-native v0.52.2 Tried the following... Actions.replace({ key: tabKey, props: tabPage }); Actions[key]({ type: ActionConst.REPLACE, tabPage: tabPage }) and…
muppet11
  • 43
  • 1
  • 7
3
votes
0 answers

How to use 'Container(flux/utils)' in TypeScript?

test.tsx import * as React from 'react'; import { Container } from 'flux/utils'; class TestComponent extends React.Component< any, any > { constructor(props, context) { super(props, context); this.state = { test : 0 }; } public static…
hohihohi
  • 77
  • 1
  • 4
3
votes
1 answer

show the error and resume the stream

I have a real-time search, but if for some reason the forkJoin fails, everything stops working. Any new words I try to look for after the error do not work. How can I show the error and resume the stream normally so that I can search for other…
user7308733
3
votes
2 answers

How setState with one value work?

I was looking through some code while using the npm package React-Select Interestingly enough i saw setState being used as such: handleSelectChange (value) { console.log('You\'ve selected:', value); this.setState({ value }); …
ApathyBear
  • 9,057
  • 14
  • 56
  • 90
3
votes
1 answer

flux / react: how to handle filtered api-data in a store

I created an app which uses the flux pattern and pulls data from an API. This is updating data how it works now: Component calls the get() action The action pulls data from an API The action dispatches a storechange event to the related store…
Felix Hagspiel
  • 2,634
  • 2
  • 30
  • 43
3
votes
2 answers

Passing a Redux Action to a child component with props

I am trying to set a video in my app as "Featured" when a user clicks on an item. I have an action creator that does a simple console.log() when called, and for testing I call it w/ componentDidMount(), and it works fine. I have a separate component…
Mike
  • 2,633
  • 6
  • 31
  • 41
3
votes
0 answers

Flux optimistic updates handled by the library?

Is there some flux library that handles optimistic updates for you? I've heard that Relay library can do that, but it only works with a graphql server (which I don't have). I would love to use a library that will handle all the flux and optimistic…
Pavle Lekic
  • 1,062
  • 1
  • 15
  • 28