> What to do if component depends on two or more cursors? For example, I render 
> game field and have state like this: {:selected [17 18], :field [[...], 
> ...]}. But each cell view depends only on one field cell and on selected 
> coordinates, e.g. on two cursors: [:selected] and [:field 5 2].
> 
> Not really sure what you're asking, but this just works.

This is what's Daniel Kersten is asking in sibling thread, but I cannot 
understand your answers, sometimes you say it's already works, and sometimes 
you say it's something you work on.

Here's an example:

(def state (atom {:selected [0 0],
                  :field [[["a"] ["b"] ["c"] ["d"]], ...]}))

(defn cell-view [??? owner]
  ...
    (render [_]
      ... access to both field and selected))

Now, to create two cursors, I do:

(render [_]
  (let [c1 (get-in cursor [:selected])
        c2 (get-in cursor [:field])]
    (om/build cell-view ??? {:init-state {:coords [0 0]}})))

The question is, how I can pass these two cursors to my cell-view? It only 
takes one.

-- 
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.

Reply via email to