Fork me on GitHub

enable-console-print!only ever needs to be called once


And I wasn't ever aware it had to be called after a figwheel reload


Sometimes you see enable-console-print! added to namespaces to ensure it is called early enough to be used in the loading of that namespace (<script> loading).


For example, I might have a (enable-console-print!) in my core.cljs. BUT this core.cljs might require a.cljs ... which means the code in the a namespace will be "loaded' before any code in core.sljs gets run (including that call to enable-console-print! in core.cljs). AND if a.cljs did some console output during the loading phase (script loading), that output won't appear unless there's a prior enable-console-print! which means it probably as to happen in a.cljs itself.


cljs dependencies are sorted in topological order, and because of that you cannot identify which namespace will be required first to put enable-console-print! there, cljs-devtools has the same issue, ideally it should be installed before any other code which could potentially call console.log or similar. See this paragraph how to do that safely without depending on dependency ordering:


Hi, which way would you guys say is the most idiomatic when changing a class on some element in a component based on for example the scrollTop attribute of the element? 1. A reagent atom local to the component (let in form-2 component) containing the class. The value of the atom is changed when the on-scroll event is triggered. 2. Subscribe to the class value from app-db, and dispatch the on-scroll event when triggered.


Probably 2. The on-scroll event would dispatch an event which would update app-db