Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 1.02 KB

Null-Dispatched-Events.md

File metadata and controls

27 lines (18 loc) · 1.02 KB

Question

If I dispatch a js event object (from a view), it is nullified by the time it gets to the event-handler. What gives?

Answer

So there's two things to say about this:

  • if you want to dispatch a js event object to a re-frame event handler, you must call (.persist event) before the dispatch. React recycles events (using a pool), and re-frame event handlers run async. Find out more here

  • it is probably more idiomatic to extract the salient data from the event and dispatch that, rather than the js event object itself. When you dispatch pure, simple cljs data (ie. rather than js objects) testing and debugging will become easier.


Up: FAQ Index