Hi im trying to set up om next with a remote api backed by datomic in a way where i can run the same datalog queries in the browser or on the server. Somehow i got the impression that this would be possible and is even an intended use case thanks to datalog. Its a beautiful idea im just struggling to get it working in the real world. Has anyone done this? Also could anyone point me to some publicly accessible sample code?
I realized my mistake was that im not using the pull syntax
https://github.com/omcljs/om/wiki/DataScript-Integration-Tutorial
I've been using Om Now on an enterprise project for three years. Now evaluating more modern tools for migration/updating of the project, including reagent, reframe, Om next and rum. Can anyone comment on why you chose Om Next as your library for React?
@ajs the model is very simple, and imo rather elegant. i also found it pretty easy to learn. Fulcro (https://fulcrologic.github.io/fulcro ; based on Om Next) is fantastic as well
Reagent also seems pretty easy
But Om is more explicit, and I prefer that
reagent/re-frame are easier for sure (hence their popularity), but om next is simpler
depends what your priorities are
I see you are making a distinction between easy and simple
indeed 😉
om next is rather more opinionated, and thus not as familiar. so there is that initial leap, which makes it less easy
Haven't read the fulcro docs yet but I went thru the Om Next tutorial and it seemed straightforward, yet I read that fulcro adds the missing pieces. What would this missing pieces be?
om next is a bit low-level and customisable, which means there is quite a lot of boilerplate and plumbing required to use it directly. fulcro makes a lot of decisions for you, and removes that boilerplate/plumbing
fulcro also provides things like routing, networking, colocated initial state, colocated css, and i18n for you
In reagent I don't like that there is a lot of implicit ambiguity. I think Om Next follows Om Now in being explicit? In reagent, an argument can be a prop, or a child, or neither, just a fn arg for other purposes. I suppose at run time reagent is having to always figure out how to treat args.
yeah i would not use reagent directly. re-frame seems decent enough though
What is i18n?
internationalization; support for multiple languages
if you haven't seen this yet: https://www.infoq.com/presentations/Simple-Made-Easy i highly recommend it
it's rich hickey's best talk imo, and it's a big part of the reason i decided to learn clojure
Have indeed seen it
ah, great 😁
One thing I like about reagent/reframe is that if two or more components need the results of the same query or calculation, it is only done once and then delivered multiple times. Haven't poured enough into Om Next queries to know if something similar happens there.
I'm guessing not since queries are mainly just a way to access data but calculations would be separate from that.
yep that is how om next queries and mutations work too, if i understand you correctly
Cool, still some learning to do there
What's the best source for good tutorials in Next?
the Om wiki is good, and the Fulcro Getting Started and Dev guide
since Fulcro is based upon Om Next, much of the Fulcro docs applies to stock Om Next
@ajs Fulcro also has some great getting started videos 🙂
Why is increment in parens here, from the Om getting started: (om.next/transact! reconciler '[(increment)])
The mutation looks for a key of just 'increment, quoted.
But that looks like a fn call
@ajs that is just how transactions look. you can also pass them params like '[(mutate {:a 1}) (other-mutate {:b 2})]
Ok guess I'll need to see more sample apps
they do look like function calls, but are just data
The entire contents of the paren is the single key?
the mutation key and the transact mutation syntax are distinct things
(-> '[(foo)] first first)
foo
(-> '[(foo)] (conj '(bar)))
[(foo) (bar)]
there is a full explanation of query syntax here: https://fulcrologic.github.io/fulcro/guide.html#!/fulcro_devguide.D_Queries
Thanks
@ajs and here is the doc on mutations: https://fulcrologic.github.io/fulcro/guide.html#!/fulcro_devguide.G_Mutation