Fork me on GitHub

Someone recently asked about best practice and it occurred to me that I don't have a summary anywhere covering any of the "more recent" developments. So I threw this entry together. What else should it contain?'

👍 14
👀 4

Shameless plug for a library I wrote 🙃. But I do genuinely think it takes Re-frame to the next level with all the modern bells and whistles, plus some nice unique features, while staying true to all the things that makes Re-frame so excellent.

👀 3

I often find people wanting to use a subscription inside of an event handler, which isn’t possible desirable. There are two “workarounds” I think of, in order of preference: 1. if an event is dispatched by something in a component, then have the component subscribe to the sub, and pass the value of the subscription into the event vector 2. extract the computation into a dedicated function of the app-db and use it in both the sub and event handler, so you no longer need to rely on the sub I like (1) because it feels a lot more in line with the “re-frame way” of modelling an application, but it has its drawbacks, as it assumes whoever is dispatching the event exists in a reactive context, and (2) doesn’t feel very nice because the event handler will never be able to make use of cached values.

🙏 4