This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
@coyotespike: sounds like progress. But not sure why you have to de-refing the atom in each button component. Shouldn't be necessary.
@coyotespike: that bit me too today. I wish reagent would warn me about it.
Switching buttons with the if
statement caused this warning:
Warning: Returning "false" from an event handler is deprecated and will be ignored in a future release. Instead, manually call e.stopPropagation() or e.preventDefault(), as appropriate.
To prevent this, I added .-preventDefault
to the button which triggered the switching.
(defn blue-swap-button [showme label]
(fn []
[:input {:class "btn btn-info palette-turquoise"
:type "button"
:value label
:on-click #(.-preventDefault (swap! showme not))}]))
(defn switch-buttons [atom default alternative]
(fn []
(if @atom
default
alternative)))
Where the button is default
, and swaps out the atom, revealing the alternative
.This fixed the warning. Anyone else run into this?
That is the last discussion about it that I can remember, not sure if there is anything more current.
Thank you! I found some IRC google archive, this is much more thorough.
Does cursors work with watchers? My problem: https://gist.github.com/thiagofm/f736826b4b0a45f06a20
@coyotespike: see the explanation here: https://github.com/Day8/re-frame/wiki/Beware-Returning-False