You cannot put changing information in :opts. David
On Thu, Dec 11, 2014 at 5:14 PM, Andrew <[email protected]> wrote: > Thanks, here's code that demonstrates the problem. It's your code with two > modifications: "edit" is in component local state, not app state. And I have > a button to change that state. In the :opts version below, this :opts doesn't > appear to pass on the new value of :edit. If I use :state instead, it does: > > (ns opts-test.core > (:require [om.core :as om :include-macros true] > [om.dom :as dom :include-macros true])) > > (enable-console-print!) > > (def app-state (atom {:foos ["foo" "bar" "baz"]})) > > (defn row [value owner {:keys [edit]}] > (reify > om/IRenderState > (render-state [_ _ #_{:keys [edit]}] > (dom/div nil > (dom/h1 nil (str edit)))))) > > (om/root > (fn [{:keys [foos]} owner] > (reify > om/IInitState > (init-state [_] > {:edit false}) > om/IRenderState > (render-state [_ {:keys [edit]}] > (apply dom/div nil > (dom/button #js {:onClick #(om/set-state! owner :edit true)} > "edit") > (om/build-all row foos {:opts {:edit edit}}))))) > app-state > {:target (. js/document (getElementById "app"))}) > > -- > Note that posts from new members are moderated - please be patient with your > first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
