re-frame/examples/todomvc
Mike Thompson 9e710d175d Explain the nature of the todomvc example 2017-07-23 11:26:21 +10:00
..
resources/public WIP. undo test fails. 2016-06-22 10:54:41 +10:00
src/todomvc Improvements in newbie documentation 2017-07-20 15:10:18 +10:00
.gitignore Switch to using CircleCI and automated testing with Karma 2015-12-10 21:47:18 +13:00
README.md Explain the nature of the todomvc example 2017-07-23 11:26:21 +10:00
project.clj Bump example dependencies, and add compilation test 2017-06-06 13:14:18 +12:00

README.md

TodoMVC done with re-frame

A re-frame implementation of TodoMVC.

But this is NOT your normal, lean and minimal todomvc implementation, geared towards showing how easily re-frame can implement the challenge.

Instead, this todomvc example has evolved into more of a teaching tool and we've thrown in more advanced re-frame features which aren't really required to get the job done.

Setup And Run

  1. Install Leiningen (plus Java).

  2. Get the re-frame repo

    git clone https://github.com/Day8/re-frame.git
    
  3. cd to the right example directory

    cd re-frame/examples/todomvc
    
  4. Clean build

    lein do clean, figwheel
    
  5. Run You'll have to wait for step 4 to do its compile, and then:

    open http://localhost:3450
    

Compile an optimised version

  1. Compile

    lein do clean, with-profile prod compile
    
  2. Open the following in your browser

    resources/public/index.html
    

Exploring The Code

From the re-frame readme:

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)

In src, there's a matching set of files (each small):

src
├── core.cljs         <--- entry point, plus history
├── db.cljs           <--- data related  (data layer)
├── subs.cljs         <--- subscription handlers  (query layer)
├── views.cljs        <--- reagent  components (view layer)
└── events.cljs     <--- event handlers (control/update layer)

Notes

Various: