re-frame

Ryan 2025-12-26T14:07:56.841069Z

I have a few UI components (e.g. a toast message popup controller) that I need to find an appropriate place to store a react Ref, any suggestions? I've made the mistake of storing them in app-db and .. that does not seem to be the place to put them 😄

Ryan 2025-12-26T14:23:12.025169Z

For the truly global ones, would it make sense to just write a local JS function to store the ref and deal with interop to call it?

siavash mohammady 2025-12-26T15:47:12.120749Z

why not in the app db?

Ryan 2025-12-26T15:56:27.724809Z

I've run into some weird issues when I put some refs in app-db, including browser tabs that just get stuck, I think becuase of of the size of some of the elements they refer to, I end up with fairly large js objects in the app-db and that seems to be trouble. Some of the other components that are simpler references to like single dom nodes seem to be fine in app-db.

2025-12-26T16:10:52.991579Z

My go-to is to create an atom using with-let:

(defn my-component
  []
  (reagent.core/with-let [el-ref (atom nil)]
    [:div {:ref #(reset! el-ref %)
           :on-click #(when @el-ref 
                        (.someMethod @el-ref))}
     "Click Me"]))

2025-12-26T16:11:58.843519Z

Note that this is a simplified example. Some might prefer to move the .someMethod call to an effect that is invoked by an event that is dispatched by the on-click handler.

🙏 2
p-himik 2025-12-26T20:02:07.078979Z

I myself prefer to use react/createRef to create a ref inside r/with-let, and use it as :ref ref and (when-let [node (.-current ref)] ...).

🙏 2
Brian Hicks 2025-12-26T16:12:29.253079Z

are there any dev tools that will let me search by sub key? Like goto definition but for subs?

Brian Hicks 2025-12-26T16:14:18.936179Z

🤦‍♂️ writing this out made me think of new search terms and I've found that it just uses the normal search functions. Neat! Yay!

Ramin Soltanzadeh 2025-12-26T21:14:05.293959Z

Hi, Is it inadvisable to use re-frame for production if one does not know React? More specifically, re-frame seems really interesting and I'm contemplating learning it. However, I am not interested in learning React right now; from what I've heard React has a steep learning curve and I'd rather invest my learning hours in Clojure and not React.

p-himik 2025-12-26T21:19:15.801619Z

It's not black-and-white like that. Knowing React would be helpful but isn't strictly necessary in general. Some specific workflows might require knowing some of it though.

Ramin Soltanzadeh 2025-12-26T21:23:43.572049Z

Would the React knowledge be basic and useful to make the most out of re-frame, or is it more of a skill to keep in the back of your pocket for debugging and edge-case quirks?

p-himik 2025-12-26T21:29:21.844109Z

What re-frame itself brings to the table is completely orthogonal to React. But re-frame depends on Reagent, and Reagent depend on React. So any knowledge of React would help its wielder with Reagent but not with re-frame. And it's both - anything you can know to make the most out of something is usually also useful during debugging.

Jose Vargas 2025-12-26T23:15:15.918429Z

This makes me wonder, why is there no implementation agnostic re-frame? I really enjoy its flux pattern, but the dependency on the reagent atom is kind of a bummer, it would be great to use it within any other context where reagent dependency is not needed nor desired

p-himik 2025-12-26T23:53:40.107489Z

> why is there no implementation agnostic re-frame? There is. :) Or even are, IIRC.

p-himik 2025-12-26T23:55:46.640139Z

Some links from my notes: • https://github.com/metosin/si-framehttps://github.com/ferdinand-beyer/refxhttps://github.com/factorhouse/rfx

siavash mohammady 2025-12-29T05:37:11.165199Z

Using reframe/reagent make development much simpler than using something like react/redux , so just basic understanding of react is required

Ryan 2025-12-26T22:33:56.706519Z

I have a few events that seem to skip being logged by re-frame-10x.. anyone have any experience with this problem? I can throw a println and see the app is running the event handler code when dispatched, but it just never shows up in event log (definitely using fn-trace) ... pulling my hair out trying to see what could be wrong

siavash mohammady 2025-12-28T04:10:51.976099Z

i have the same issue in firefox