mirror of
https://github.com/status-im/re-frame.git
synced 2026-08-31 05:41:14 +00:00
1.0 KiB
1.0 KiB
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
dispatcha js event object to a re-frame event handler, you must call(.persist event)before thedispatch. 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
dispatchthat, rather than the js event object itself. When youdispatchpure, simple cljs data (ie. rather than js objects) testing and debugging will become easier.
Up: FAQ Index