Baobab: A JavaScript data tree supporting Om-style cursors, with React mixins
github.com
github.com
It takes some getting used to, but the mixins help reduce your code to actions + store + views and make it easier to reason about. There's a good post about it, including simple server integration, here:
https://www.codementor.io/reactjs/tutorial/flux-reactjs-stat...
I was surprised at the lack of attention it got, but I hope that changes because there are some good ideas here.
At first it worked out great for us but as our application grew both in scope and number of developers involved, we quickly ended up with a 'cursor soup' where too many components were watching for changes individually.
It had a very negative impact on performance since components would potentially re-render multiple times for a single change. In our last implementation we ended up overcoming this by some fancy event consolidation, but even so we had too many components 'touching' our tree.
We ended up reverting to a much simpler architecture and it has both made our application dumber (which is great in terms of maintenance) but also more performant. We currently have actions/stores/views where actions themselves are dispatchers. By creating a few helper functions we overcome a large part of the boilerplate but even without, it has proved worth it for us.
Another important gain for us was re-usability of components. We have several projects that use the same components that represent the same data but the hierarchy of the internal state of the application can look quite different from one another. Passing everything in as props and avoiding as much state as possible has made this much easier as well.
I guess at the end of the day everything is a tradeoff one way or another and you just have to pick yours, as cliche as that sounds. For us simplicity was more important in this particular case.
https://github.com/Yomguithereal/baobab/wiki/Options
"When you use the mutation methods of Baobab (push, set, merge etc.) it will batch up these changes and make one single commit, which then triggers update events."
I haven't worked with Om on a non-trivial project yet, so please correct me if I'm wrong, but I believe Om might also do similar optimizations (i.e. batching updates and sending notifications in sync with its render on requestAnimationFrame flow).
See this issue for more details: https://github.com/Yomguithereal/baobab/pull/74
A blog post[1] from Christian Alfoni with some examples helped me get started with it. The tree becomes a nice summary of your application which makes it easier for someone new to your project to make sense of it. Also there's another post about going isomorphic with it[2], which is intriguing.
[1]: http://christianalfoni.github.io/javascript/2015/02/06/plant...
[2]: http://christianalfoni.github.io/javascript/2015/03/01/true-...
Will definitely check this out though, it seems sensible.
A superficial and perhaps temporary difference is "for performance and size reasons baobab does not (yet?) use an immutable data structure", whereas immstruct wraps immutable-js.
I'm curious if there are other differences though because at first glance they seem to be separate implementations of similar ideas.
So far, we have:
XML -> JSON
BaseX, eXistdb -> MongoDB, RethinkDB
XSD, DTD -> JSON Schema
WSDL -> HATEOAS
XML-RPC -> JSON-RPC
XPath -> JSONPath
xmlns -> JSON-LD
SAX -> clarinet
--------------------
Would we have:
XSLT -> Baobab ?
[1]: http://swannodette.github.io/2015/01/06/the-false-promise-of...
I am unclear what this lib brings to the table.