Fork me on GitHub
#re-frame
<
2023-01-24
>
J Crick12:01:50

This may be just a newbie CLJS question... I'm curious about how re-frame registers events. I'm doing my first re-frame app, and I used the lein app booter. I tried adding an additional file registering events, separating db events from fx events (rather than having them all munged up in events.cljs), and I required it in core.cjs, but my event handlers aren't registering. I tried searching the docs to understand how re-frame loads the subs and events, but I couldn't find anything. Can someone here point me in the right direction, or give me an idea of how this works?

p-himik12:01:31

Event registering is just a function call, there's no magic to it.

J Crick15:01:16

Thanks for your reply @U2FRKM4TW. I guess I'll have to research why the functions aren't being called, then.

valtteri15:01:19

You need to require the namespace where the functions (reg-event … etc) are. You can do it in the applications main namespace.

J Crick15:01:03

I wondered about that. I didn't see any require for events.cljs or subs.cljs in my core.cljs, so I was wondering if there was some configuration magic going on. Anyway, I'll give that a try. Thanks @U6N4HSMFW!

👍 2