On Github Cspeisman / flux-presentation
(flux and redux)
functional programming
Flux architecture
Redux
No side effects
Easy to unit test
stateless
function countUsers(users) { return users.length }
stateless
function countDeactivatedUsers(allUsers, activeUsers) { return allUsers.length - activeUsers.length }
composability!
function countUsers(users) { return users.length } function countDeactivatedUsers(allUsers, activeUsers) { return countUsers(allUsers) - activeUsers.length }
Not Stateless
/* Both these functions become statefull */ function countDeactivatedUsers(allUsers, activeUsers) { return countUsers(allUsers) - activeUsers.length } function countUsers(users) { users = localStorage.users return users.length }
Not Stateless
function countDeactivatedUsers(allUsers, activeUsers) { return countUsers(allUsers) - activeUsers.length } function countUsers(users) { /* MUTATION!!! Whatta jerk!! */ users.pop() /* cover up */ return users.length + 1 }
Not Stateless
var extras = [] function countDeactivatedUsers(allUsers, activeUsers) { return countUsers(allUsers) - activeUsers.length - extras.length; }
Not Stateless but appears it.
function countDeactivatedUsers(allUsers, activeUsers) { localStorage.users = allUsers; return countUsers(allUsers) - activeUsers.length; }
Facebook decided to try a new architecture where data flows in one direction, and one direction only (make clever one direction boy band joke)