Skip to content

Instantly share code, notes, and snippets.

@niquola
Last active June 28, 2021 21:04
Show Gist options
  • Save niquola/91675658284d4c2a229321b6fd7b08f9 to your computer and use it in GitHub Desktop.
Save niquola/91675658284d4c2a229321b6fd7b08f9 to your computer and use it in GitHub Desktop.

Design doc for re-frame forms

  1. All state in db!
  2. Form is configured by schema (not by widgets) - i.e. form logic works without widgets
  3. Components configured with form-path + field-path - {:zf/root [::form] :zf/path [:name :family]}

Form state in db

:zf/root 
  {:value {....}
   :errors {....}
   :state {....}
   :schema {....}}

Schema

{:name 
  {:validate 
    {:zf/require {:value true}
     :zf/min-length {:value 5 }}
 :gender {:options [{:value "..." :title ""}, {...}]
 :zf/submit {:event :do-submit }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment