petterik / lajter

MIT License
3 stars 0 forks source link

update-state, transact without passing this #46

Open petterik opened 6 years ago

petterik commented 6 years ago

Could add new functions for interacting with a component that doesn't have to pass this

Example:

;; instead of:
(dom/button #js {:onClick #(la/update-state! this (fn [state] (assoc state :foo :bar)))})
;; Could have:
(dom/button #js {:onClick (la/update-state #(assoc % :foo :bar))})

Notice that:

Same for transact, possibly for the computed functions as well and others?

petterik commented 6 years ago

Might want to bind additional *props* and *state* vars as well, to access reads and state without passing this. Examples:

(la/read :people)
(la/state :foo)

Not sure if this is useful though.