Fork me on GitHub
Richard Bowen18:04:59

Hey, trying to execute an event but I get this error when I try:

re-frame: no :event handler registered for: ...
How do I properly register an event. I have an effect defined using reg-fx which I dispatch in a reg-event-fx. What am I missing?


Events and effects are different things. You don't dispatch effects, you dispatch events. In order to use an effect, you return a map with the right keys/values from the handler function registered with reg-event-fx.


Also, such questions are better suited for #re-frame

👍 1
Richard Bowen20:04:42

I understand how to use events and effects now and I have that working. I'm coming across another error I haven't experienced before. I'm trying to import a js package, specifically copy-to-clipboard , like this:

["copy-to-clipboard" :refer [copy]]
However, it fails with an error:
Uncaught TypeError: module$node_modules$copy_to_clipboard$index.copy is not a function
    at eval (effects.cljs:66:5)
    at re_frame$fx$do_fx_after (fx.cljc:59:23)
    at Object.re_frame$interceptor$invoke_interceptor_fn [as invoke_interceptor_fn] (interceptor.cljc:70:6)
    at Object.re_frame$interceptor$invoke_interceptors [as invoke_interceptors] (interceptor.cljc:108:24)
    at Object.re_frame$interceptor$execute [as execute] (interceptor.cljc:201:8)
    at Object.re_frame$events$handle [as handle] (events.cljc:65:14)
    at Object.eval [as re_frame$router$IEventQueue$_process_1st_event_in_queue$arity$1] (router.cljc:179:10)
    at Object.eval [as re_frame$router$IEventQueue$_run_queue$arity$1] (router.cljc:198:44)
    at eval (router.cljc:146:64)
    at Object.eval [as re_frame$router$IEventQueue$_fsm_trigger$arity$3]
Any tips?


For future reference - you should not ask that in an unrelated thread. This question in #clojurescript would've been more fitting. But seems like your :require of that package is incorrect. And on how to import it exactly - refer to the docs of your build tool.