This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-30
Channels
- # aws (2)
- # beginners (139)
- # boot (9)
- # cider (1)
- # clara (2)
- # cljs-dev (35)
- # cljsrn (3)
- # clojure (112)
- # clojure-dusseldorf (9)
- # clojure-greece (6)
- # clojure-italy (13)
- # clojure-russia (160)
- # clojure-seattle-old (1)
- # clojure-uk (79)
- # clojurescript (85)
- # clojutre (1)
- # community-development (11)
- # core-async (32)
- # cryogen (2)
- # cursive (5)
- # data-science (16)
- # datomic (2)
- # events (1)
- # fulcro (29)
- # funcool (1)
- # graphql (4)
- # immutant (5)
- # instaparse (20)
- # jobs (2)
- # juxt (6)
- # leiningen (11)
- # luminus (21)
- # lumo (1)
- # off-topic (7)
- # onyx (20)
- # parinfer (33)
- # pedestal (4)
- # re-frame (41)
- # reagent (34)
- # ring-swagger (14)
- # rum (5)
- # spacemacs (9)
- # specter (11)
- # sql (14)
- # test-check (3)
- # yada (20)
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 ) …
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?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?
@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 🙂.