What does HackerNews think of rum?

Simple, decomplected, isomorphic HTML UI library for Clojure and ClojureScript

Language: HTML

In the context of this article, it's worth pointing out that hiccup doesn't escape strings automatically. Rum does, and I've been using it as a drop-in replacement:

    user> (require '[rum.core :as rum]
                   '[hiccup.core :as hiccup])
    nil
    user> (rum/render-static-markup [:p "alert('you have been pwned')"])
    "

<script>alert('you have been pwned')</script>

" user> (hiccup/html [:p "alert('you have been pwned')"]) "

alert('you have been pwned')

"
(Note that Rum is also a React wrapper, but you don't have to use that part of it; you can simply use it for static rendering of HTML.)

https://github.com/tonsky/rum

I love React as long as it has a thin skim of clojurescript over top. Rum is the underdog compared to reagent but is still my weapon of choice - https://github.com/tonsky/rum

Was disillusioned when I had to dive into a pure js project using React.

The real benefit, I think, is that you get the well established Clojure idioms around isolating and managing mutable state.

State is stored in a Atom, which is atomically mutated, and reactive components essentially 'subscribe' to updates upon that atom to re render.

The mutations can be handled centrally by a message queue, but really, event sourcing like that is not always needed.

I've had an in-browser animated meme editor in the freezer for a few years now:

https://www.ultime.me/

The idea came when I wanted to make a simple animated meme, but found it exceedingly frustrating to caption a simple animated gif with nice text options (like outlines). Over time, it's grown to have full keyframe animation for all text and image/video clip attributes, so it is actually pretty capable short of using a desktop video editing/fx package.

That said, the UX is bad and I should feel bad :) . I made the deliberate choice up front to focus on the underlying data model and internal APIs rather than polishing the UI - as such, it is very much an engineer interface. It would be more usable with some demo videos or call-to-action helpers for new users, but really the UX just needs reworked. Especially around animation/keyframing.

On the bright side, the clean data model and content addressable assets leave the path clear to add things like collaborative multi-user meme editing, git like meme-forking(and diffing?), and so forth.

Started it about 3 years ago when I had a period of mostly free time to play. It's been idle for a long time due to starting a family and getting consulting momentum, but I'm intending to make the time this year to polish the UX to the point of general usability and experiment with promotion/monetization. Failing that, I'll probably just open source it and write a couple of blog posts about the internals.

It is more or less a static web app, with no server side function short of some optional stats collection. It's written in Clojurescript/Clojure and uses https://github.com/tonsky/rum as a React wrapper and https://github.com/Kagami/ffmpeg.js/ to import most animation formats and export gifs/webm fully in browser (I don't want to pay real server costs to encode animation).

It's weird how in the JS community rewrites of react are common in the CLJS community using React as a runtime is more common:

  - https://reagent-project.github.io/
  - https://github.com/day8/re-frame
  - https://github.com/tonsky/rum
And my favourite - https://github.com/fulcrologic/fulcro

Hosting your work on top of another ecosystem, such that you can still use the underlying ecosystem, gives you a lot of leverage out the gate

ClojureScript user here, with a big SaaS app using React, developed over the last 4 years or so, using the excellent Rum library, https://github.com/tonsky/rum.

It seems to me that React Hooks, like so many things in the JavaScript world, solve a problem I do not have. To this day, despite being a heavy user of React, I don't even fully know what they do. I've read the "Motivation" section of the React Hooks Intro, and it seems that I have none of the problems they describe: I can (and do) easily add stateful logic via Rum mixins, and that logic is reusable across components. Also thanks to Rum mixins, complex logic is understandable and does not get all thrown into a single 'componentDidMount' function. As to "Classes confuse both people and machines", I find it hard to relate to this problem, because I don't really see any classes. I work with components that have a render function and mixins, and if you don't use any mixins, a component looks just like a function.

This tends to be a recurring theme: every once in a while I read an article about JavaScript and React, and I can't even relate to the problems, because they do not exist in my world. Another good example is hints on how to optimize apps to avoid excessive re-rendering, something I get for free with ClojureScript and immutable data structures (you can always quickly tell if two data structures are equal and avoid rendering).

Reagent is good for starting if you are new to React, but quickly becomes limiting.

I found Rum (https://github.com/tonsky/rum) to be a much more flexible choice. It doesn't force you into a single way of doing things, but rather offers a composable way of adding behavior to components using mixins. Especially for larger and more complex applications this proves to be a good tool.

Another thing which I really like about Rum is "isomorphic rendering" (not a good name, but I didn't invent it) — pre-rendering the DOM on the server instead of shipping an empty page to the client and requiring the client to render everything using JavaScript.