rum

Simple, decomplected, isomorphic HTML UI library for Clojure and ClojureScript | 0.12.8 https://github.com/tonsky/rum/blob/gh-pages/CHANGELOG.md#0128
pez 2017-08-30T07:15:26.000078Z

Two newbie questions regarding client side rum. Both because I need to make a an element on the page sticky when scrolled to the top of the page. (Very similar to the search bar here: https://codepen.io/chriscoyier/pen/AdaKr ) …

pez 2017-08-30T07:33:17.000152Z

Q1. My current solution uses the same technique as that code pen does. Installing a listener on the scroll event and changing a class on the sticky element when the scroll value equals the top position of the element on the page. Installing the listener is the problem for me. Currently I do it inside the component hiccup when the client app has started. Leaving an empty [:span] element as the “result” of the code. Like so

[:div#my-sticky-container
   #?(:cljs
      (do
        (when should-listener-install?
          (sticky/install-listener "my-sticky"))
        [:span]))
I’m memoizing the function to make sure the listener only install once. This works, but I think there should be a better way to install a listener like that. How would you do it?

pez 2017-08-30T07:35:24.000356Z

Q2: The current solution seems a bit like forcing a foreign paradigm onto Rum and React. Is there a more Rum “native” way to do it?

pepe 2017-08-30T10:22:06.000370Z

@martinklepsch for managing state I am very happy with https://github.com/funcool/potok I was just thinking how to add derivates into the mix, but in this phase of my project I am quite happy with rum/cursor 🙂.

pez 2017-08-30T14:49:12.000780Z

Hmmm, sorry for that guys, I didn’t know things where crossposted here. I tried to do the right thing! 😀 (And now it crossposted this to Gitter as well.)