intro&to&flux% - spark solutions · whatis& flux&implementaon&use?& 1....

35
Intro to Flux Damian Legawiec CEO of Spark Solu9ons @damianlegawiec

Upload: others

Post on 30-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Intro  to  Flux  

Damian  Legawiec  CEO  of  Spark  Solu9ons  

 @damianlegawiec

Page 2: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

What  is  Flux?  

Framework?  

Page 3: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

What  is  Flux?  

Framework?    

Library?  

Page 4: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

What  is  Flux?  

Framework?    

Library?  Kinda  :)  

Page 5: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

What  is  Flux?  

Architecture  PaGern  

Page 6: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

What  is  Flux?  

Architecture  PaGern  One  Way  Data  Binding  

Page 7: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

What  is  Flux?  

Architecture  PaGern  One  Way  Data  Binding  Framework  Agnos9c  

Page 8: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

What  is  Flux?  

Architecture  PaGern  One  Way  Data  Binding  Framework  Agnos9c  

Not  MVC  :)  

Page 9: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

What  is  Flux?  

Page 10: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Store  

Model?  

Page 11: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Store  

Model?  

Page 12: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Store  

Model?  Collec9on?  

Page 13: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Store  

Model?  Collec9on?  

Page 14: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Store  

 Applica9on  State  Container  

Page 15: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Store  

Applica9on  State  Container  Can  be  used  with  ORM  

Page 16: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Store  

Applica9on  State  Container  Can  be  used  with  ORM  

Simple  JavaScript  object  enhanced  by  EventEmi2er  or  MicroEvent  

Page 17: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Ac9ons  

Used  to  invoke  Change  of  state  

Page 18: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Ac9ons  

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

Ac9ons  

Page 19: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Ac9ons  

Used  to  invoke  Change  of  state  Invoked  from  Views  (Components  in  React)  They  pass  arguments  (payload)  to  Dispatcher  

Ac9ons  

Page 20: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Dispatcher  

There  can  be  only  one!  

Ac9ons  

Page 21: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Dispatcher  

There  can  be  only  one!  Dispatches  Ac?ons  to  the  Store  

Dispatcher  Ac9ons  

Page 22: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Smart  Components  

Aware  of  Store  

Page 23: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Smart  Components  

Aware  of  Store  Listen  for  Store  change  

Page 24: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Smart  Components  

Aware  of  Store  Listen  for  Store  change  

Data  is  in  State  

Page 25: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Smart  Components  Aware  of  Store  

Listen  for  Store  change  Data  is  in  State  

Pass  data  via  props  to  Dumb  Components  

Page 26: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Dumb  Components  

Only  display  data  passed  in  props    

Page 27: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Single  Page  App  Example  

https://greetabl.com/builder

Page 28: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Web  App  Example  

https://milanstyle.com

Page 29: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

When  to  use  Flux?  

Single  Page  App  Complex  UI  

Real  World  apps  :)  

Page 30: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

When  not  to  use  Flux?  

Learning  React  :)  Simple  components  enhancing  sta9c  site  

 

Page 31: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

What  is  Flux  implementa9on  use?  

Short  Answer  REDUX  

Page 32: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

What  is  Flux  implementa9on  use?  

Long  Answer    

Page 33: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

What  is  Flux  implementa9on  use?  

1.  Start  with  official  Facebook  one  2.  Choose  between  more  conven9onal  

ones  (Reflux,  Alt)  or  bleeding  edge  Redux  

Page 34: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Future  reading  List  

1.  hGps://facebook.github.io/flux/docs/overview.html#content  

2.  hGp://blog.andrewray.me/flux-­‐for-­‐stupid-­‐people/  

Page 35: Intro&to&Flux% - Spark Solutions · Whatis& Flux&implementaon&use?& 1. Startwith&official&Facebook&one& 2. Choose&between&more&conven9onal& ones&(Reflux,&Alt)&or&bleeding&edge& Redux&

Thanks  for  your  aGen9on!