Skip to content

A sample project to experiment a flux-ish architecture

Notifications You must be signed in to change notification settings

coybit/WhatToCook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WhatToCook is a simple sample app to experiment with a simplified version of Flux architecture.

Architecture

Instead of having one central store, we have a hierarchy of stores:

Each store comprises:

  • a reducer method
  • a side-effects handler method
  • an immutable state object
  • an environment object that carry dependencies around.

Navigator, the object that is responsible for handling navigation is one example of dependencies we have. Each store has a custom navigator tailored based on where user can navigate to from the part of the app the store is representing. Each store is in charge of creating its child store.

The sequence diagram is quite simple:

  1. The store received an event (Action) from somewhere (doesn't matter from where)
  2. The store passes the event along with the current state to the reducer
  3. The reducer returns a new state, plus side-effect if there is any
  4. The store asks side-effect handler to handle each side-effect
  5. The store call on(chage:) method to notify the subscriber that state has changed

About

A sample project to experiment a flux-ish architecture

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages