re-frame
a.k.a what redux should have been
About me
{ :name "Boogie"
:job #{"Staff Engineer", "Ocasional Door Fixer"}
:job-translation "Basically, i write code..."
:company "Victory Square Partners"
:social { :twitter "@_boogie666_" }}
This is not JSON btw, it's EDN, look it up, i had to sneak in a little clojure :P
What redux does well
What redux does poorly
What redux does poorly - possible fixes
So what do?
What is re-frame?
The BIG Idea - a layer of indirection
Make "events" produce "effects" and handle them outside of the effect handler, thus keeping the effect handlers pure.
Wait a minute.... WTF is?
The building blocks of re-frame
There's other bits in the original framework, but they are not important for the main thing
Events
<button onClick={() => dispatch(someEvent)}>Click Me!</button>
Just like redux
Effects
function clickMe({ state }, event){
return {
state: < somehow update the state >
http: < describe in data the http call >
};
}
state and http are effects (i.e descriptions of things that are about to happen)
Let's see some code
A an example i've setup this, this a "real world example" of this architecture in action.
Actual link: