Fork me on GitHub
#re-frame
<
2023-05-22
>
mikethompson00:05:29

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?' https://github.com/day8/re-frame/blob/master/docs/FAQs/BestPractice.md

👍 14
👀 4
zalky21:05:12

Shameless plug for https://github.com/zalky/reflet 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
hifumi12301:05:27

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