FAQ: What is the best way to learn Electric? • the best way to learn Electric is to type in each tutorial example and replicate it on your machine. This is how I learned Clojure, Scala, Haskell, SICP - typing in code from books. • Why this works? Because getting simple examples working is a forcing function for you to pay attention to the details—understand every single line—and develop basic debugging skills in small apps before you try to "swallow the elephant whole" and build your ambitious project. • The ~dozen or major examples in the Electric v3 tutorial covers a LOT of ground in a very tiny amount of lines of code. The current tutorial has 22 pages, but many of them overlap and build up on each other. • I believe an experienced Clojure/Script developer can get all the way up to the first Todos app in a single workday, and can get all the way through TodoMVC in a second day. Our TodoMVC is only 200 LOC! • Ignore this advice at your peril: when you need to debug your ambitious project—debug, because its code is incoherent, because you didn't learn the fundamentals first—you will waste far more than two days painfully debugging, likely ultimately failing and giving up
I want to validate this claim: > I believe an experienced Clojure/Script developer can get all the way up to the first Todos app in a single workday, and can get all the way through TodoMVC in a second day. Our TodoMVC is only 200 LOC! If/when y'all attempt this, please report back with your experience
I will let you know! But I would be a terrible reference case. I'm a below average Clojurist at best, and not an 'experienced Clojure/Script' developer by any means. All I have going for me is some instinct for the right languages and tools. So I won't validate much, either way. 🙂
You've nailed it. > because you didn't learn the fundamentals first This has gone on for years for me. Advice taken to heart.
And I would suggest that making the demo/starter code your own is a good follow-on step. Getting the starter code working in my Polylith project was quite educational—forces you to understand how and why everything fits together.
Just be ready to do most of the debugging yourself. (Which is exactly why it's a valuable practice.)
yeah we don't want to be supporting (debugging) people's custom entrypoints, so i would encourage y'all to delay integration into a larger project until after tutorial mastery
Datomic entity navigator we are working on this week
Approximately the same abstraction targeting a Clojure namespace and navigating into a var (it can target any object for navigation)
Are there any follow-along tutorials that implement something simple in electric? I love the paradigm but will, I'm sure, struggle to implement a todo list/address book level app.
https://electric.hyperfiddle.net/tutorial/todomvc implements TodoMVC, both bakcend and frontend, with dirty state and more. If you start from the first tutorial, read the explanations and try to rewrite the demos yourself you should be able to ramp up towards it.
Endorse what @xifi said; the best way to learn Electric is to type in each tutorial example and replicate it on your machine. This is how I learned Clojure, Scala, Haskell, SICP - typing in code from books. The ~dozen or major examples in the Electric v3 tutorial covers a LOT of ground in a very tiny amount of lines of code, you can get all the way up to TodoMVC in a single Saturday
Another question: I'm interested in leveraging modular UI components for nice interfaces. Reagent lets you npm install UI elements and use them (if I have that right). I know that won't work here. But I'd like to be able to utilize existing UI libraries (i.e. Flowbite) hopefully while being able to separate logic and UI code a bit. Are there any strategies around this?
https://gitlab.com/hyperfiddle/electric-fiddle/-/blob/9cfc14242306fff334bae6c49c719037161d5d33/src/electric_tutorial/reagent_interop.cljc is an example of using reagent. It's for v2 but should work the same way if one swaps in the v3 requires
https://clojurians.slack.com/archives/C7Q9GSHFV/p1735784178469699
That example is so fantastic! I'm super excited to get better at all this now. I'm a real-time dashboard and charts fan.
One can certainly build reusable components in electric. Actually they are more reusable than reagent libs, because electric can abstract away the client-server communication. Embedding react, reagent etc is straightforward, we have examples of that lying around in scratches and in the channel
Great! Any pointers to the scratches would be awesome. But I'll search this channel, too.
I found this: https://github.com/hyperfiddle/electric-v2-tutorial for which I'm totally grateful. But I'd be interested in how one builds up an app and being able to follow that process.
electric v2 is superseded, that repo will not help you, the electric v3 tutorial is here: https://electric.hyperfiddle.net/
electric v3 starter app: https://gitlab.com/hyperfiddle/electric3-starter-app