This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # aatree (2)
- # beginners (14)
- # boot (190)
- # cider (16)
- # cljs-dev (15)
- # cljsjs (6)
- # cljsrn (7)
- # clojure (101)
- # clojure-austin (26)
- # clojure-berlin (2)
- # clojure-estonia (4)
- # clojure-greece (53)
- # clojure-russia (46)
- # clojurescript (44)
- # core-async (12)
- # cursive (57)
- # data-science (49)
- # datomic (5)
- # emacs (8)
- # hoplon (92)
- # ldnclj (20)
- # lein-figwheel (22)
- # leiningen (4)
- # mount (37)
- # om (103)
- # onyx (26)
- # parinfer (70)
- # proton (6)
- # re-frame (32)
- # reagent (1)
- # yada (24)
hey guys, I've noticed that if I pass an event object from an event handler on a component to
dispatch it arrives nullified in the handler; should I expect this behavior or am I doing something wrong? I know that event nullification happens with React, but it should come after the event handler had fired.
@leonid-shevtsov yeah, if you want to use a react event object after the event handler that received it, you have to call
(.persist event). It gets recycled by the react event pooling system if you don't do that.
It is probably more idiomatic to extract the necessary contents from the event and send just that data along in the event, rather than the js object itself.
@leonid-shevtsov: ^^ when your events are pure, simple data (rather than js objects) testing and debugging becomes a fair bit easier. IMO.
Thanks for the question and answer. I've created a new FAQ entry (I have seen this question come through before): https://github.com/Day8/re-frame/wiki/FAQ#6-dispatched-events-are-null
Agreed with you @mikethompson, simple data FTW. I should have recommended to not dispatch the react event, instead of helping in how to do it :)
Getting this very strange error with a not-so-helpful stacktrace — does it look familiar to anybody?
@martinklepsch: this stacktrace is strange because re-frame dispatches events asynchronously.
@martinklepsch: refer to https://github.com/Day8/re-frame/wiki/Debugging-Event-Handlers to undestand how you can better debug event handlers
@mikethompson: figured it out, (reagent/props) only works when you pass a map, not a vector, to the inner component, due to hiccup
in which case I feel like all params should be passed as maps from component->component
@kanwei: are we talking about this issue? https://github.com/Day8/re-frame/wiki/Using-%5B%5D-instead-of-%28%29#appendix-2
Okay, I'm slightly puzzled. But not enough time right now. Feel free to add any insights to the bottom of: https://github.com/Day8/re-frame/wiki/Using-Stateful-JS-Components