Why use re-frame?
You are developing [Single Page Applications (SPA)] in ClojureScript, and you are looking for a framework and guidelines on how to organise the parts of that application effectively.
immutable datais the right approach for your application.
Functional Model View Controller design
re-frame has Model, View, and Components in its design, created with pure functions (or pure data). An application is wired together via reactive data flows.
To build a re-frame app, you:
- design your app's data structure (data layer)
- write and register subscription functions (query layer)
- write Reagent component functions (view layer)
- write and register event handler functions (control layer and/or state transition layer)
- The functions you write are pure, so the computational pieces of your app can be described, understood and tested independently. You won't need sophisticated Dependency Injection to test. So much incidental complexity evaporates.
- These computational parts are composed via reactive data flows - a dynamic, unidirectional Signal graph.
- The resulting architecture involves "derived data" flowing in a two-stage, reactive loop. Without realising it, you will be explicitly modelling time.
- It is fast, straight out of the box. You won't have to go through this sort of pain.
- The surprising thing about re-frame is how simple it is. Beautifully simple! Our reference implementation is little more than 200 lines of (ClojureScript) code. Learn it in an afternoon.
- But it scales up nicely to more complex apps. Frameworks are just pesky overhead at small scale - measure them instead by how they help you tame the complexity of bigger apps.
- Re-frame is impressively buzzword compliant: it has FRP-nature, unidirectional data flow, pristinely pure functions, conveyor belts, statechart-friendliness (FSM) and claims an immaculate hammock conception. It also has a charming xkcd reference (soon) and a hilarious, insiders-joke T-shirt, ideal for conferences (in design). What could possibly go wrong?