Flux Architecture Pattern for React Native

Estimated read time 2 min read

Flux is an architecture pattern used in React / React Native for building a User interface. The application will be split into parts using Flux.

In General Flux Pattern addressing the below pain points in the React / React Native Development

Bidirectional data flow

Due to bidirectional flow, one change caused by the event can loop back and cascade the effect throughout the application

Event Problems

when we couple more and more components tightly and pass an increasing number of listeners down to the props chain

Issues with Binding

When we are going with one way or two-way data binding if the events occur all over the application it’s hard to debug and identify the issues.

Flux Architecture

Dispatcher

Will send events to all of the registered components. This manages actions and corresponding callbacks. It has register and unregister methods for the callbacks and also has a dispatch method to dispatch actions

Store

The data will be mapped to the corresponding views based on the Store callbacks registered in the Dispatcher

Action Creators

This will compose the data into an action object and delivered it to the Dispatcher.

Sample Data Flow of FLUX Patterns

In the Data flow, all the actions go to the Dispatcher and are then sent to the registered store callbacks. Finally, the store content is mapped to the View.

Loading...