Does anyone have any sample code to integrate om cursors with nativestore?
Thanks!
NativeStore is intended as an alternative method for managing state in Om via the Derive library (http://github.com/vitalreactor/derive). In my system, cursor state only passes dynamic UI state and key parameters, such as a todo-id and an edit flag. The bulk of the TODO element data is read from NativeStore. I will stress that for relatively simple systems like the TODO app, NativeStore is serious overkill. It makes sense when your data model is large and/or complicated such as having a graph-like structure or many cross-dependencies. I have all of the above in my app which is about to cross 10k lines of CLJS.
The way this integration works is described at the bottom of the NativeStore README.md. In short, you need to wrap any calls to derive functions or cursors with the derive/on-changes macro which registers a callback with the store so that the component's om/refresh! method is called when a NativeStore transact! updates any of the data that the component accessed which in turn causes the component to be added to the Om render queue.
The interactions here are a little subtle, and not quite as easy to reason about as the cursor model, so I'll work up a simple example/tutorial of usage in the NativeStore repository tonight to illustrate Om integration. This will work equally well for other Clojurescript React wrappers I believe.
Ian
- Viksit
--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to a topic in the Google Groups "ClojureScript" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/LgJue_mbBew/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.