intro to flux - reactjs warsaw #1

Post on 15-Apr-2017

2.066 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Intro to Flux

Damian LegawiecCEO of Spark Solutions

@damianlegawiec

What is Flux?

Framework?

What is Flux?

Framework?

Library?

What is Flux?

Framework?

Library? Kinda :)

What is Flux?

Architecture Pattern

What is Flux?

Architecture PatternOne Way Data Binding

What is Flux?

Architecture PatternOne Way Data BindingFramework Agnostic

What is Flux?

Architecture PatternOne Way Data BindingFramework Agnostic

Not MVC :)

What is Flux?

Store

Model?

Store

Model?

Store

Model?Collection?

Store

Model?Collection?

Store

Application State Container

Store

Application State ContainerCan be used with ORM

Store

Application State ContainerCan be used with ORM

Simple JavaScript object enhanced by EventEmitter or MicroEvent

Actions

Used to invoke Change of state

Actions

Used to invoke Change of stateInvoked from Views (Components in React)

Actions

Actions

Used to invoke Change of stateInvoked from Views (Components in React)

They pass arguments (payload) to Dispatcher

Actions

Dispatcher

There can be only one!

Actions

Dispatcher

There can be only one!Dispatches Actions to the Store

DispatcherActions

Smart Components

Aware of Store

Smart Components

Aware of StoreListen for Store change

Smart Components

Aware of StoreListen for Store change

Data is in State

Smart ComponentsAware of Store

Listen for Store changeData is in State

Pass data via props to Dumb Components

Dumb Components

Only display data passed in props

Single Page App Example

https://greetabl.com/builder

Web App Example

https://milanstyle.com

When to use Flux?

Single Page AppComplex UI

Real World apps :)

When not to use Flux?

Learning React :)Simple components enhancing static site

What is Flux implementation use?

Short AnswerREDUX

What is Flux implementation use?

Long Answer

What is Flux implementation use?

1. Start with official Facebook one2. Choose between more conventional

ones (Reflux, Alt) or bleeding edge Redux

top related